liquid icon indicating copy to clipboard operation
liquid copied to clipboard

feat: add UnregisterTag engine method

Open jaime-amate opened this issue 1 month ago • 0 comments

The aim of this PR is to add a function that allows to remove a defined tag. This is useful for my specific need as I need to disable a standard tag ({% include %}) and still get a parse error.

Currently in order to disable a standard tag, you can:

// Register a tag that always returns an error
engine.RegisterTag("include", func(c render.Context) (string, error) {
    return "", fmt.Errorf("Tag include is not allowed")
})

This overrides the existing tag functionaly of include and will throw an error at render time. Adding UnregisterTag allows to remove standard tags dinamically.

Checklist

  • [x] I have read the contribution guidelines.
  • [x] make test passes.
  • [x] make lint passes.
  • [x] New and changed code is covered by tests.
  • [ ] Performance improvements include benchmarks.
  • [ ] Changes match the documented (not just the implemented) behavior of Shopify.

jaime-amate avatar Nov 18 '25 15:11 jaime-amate