mirror of
https://github.com/Shopify/liquid.git
synced 2026-10-03 00:55:11 -07:00
Merge pull request #1474 from Shopify/clarify-warn-error-mode-doc
Clarify that the error_mode: :warn parse option is only for strict errors
This commit is contained in:
@@ -63,13 +63,13 @@ when templates are invalid. You can enable this new parser like this:
|
|||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
Liquid::Template.error_mode = :strict # Raises a SyntaxError when invalid syntax is used
|
Liquid::Template.error_mode = :strict # Raises a SyntaxError when invalid syntax is used
|
||||||
Liquid::Template.error_mode = :warn # Adds errors to template.errors but continues as normal
|
Liquid::Template.error_mode = :warn # Adds strict errors to template.errors but continues as normal
|
||||||
Liquid::Template.error_mode = :lax # The default mode, accepts almost anything.
|
Liquid::Template.error_mode = :lax # The default mode, accepts almost anything.
|
||||||
```
|
```
|
||||||
|
|
||||||
If you want to set the error mode only on specific templates you can pass `:error_mode` as an option to `parse`:
|
If you want to set the error mode only on specific templates you can pass `:error_mode` as an option to `parse`:
|
||||||
```ruby
|
```ruby
|
||||||
Liquid::Template.parse(source, :error_mode => :strict)
|
Liquid::Template.parse(source, error_mode: :strict)
|
||||||
```
|
```
|
||||||
This is useful for doing things like enabling strict mode only in the theme editor.
|
This is useful for doing things like enabling strict mode only in the theme editor.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user