-
-
Notifications
You must be signed in to change notification settings - Fork 495
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change liquidjs
parameter parsing to use Liquid’s Tokenizer
#2679
Comments
Hey, just checking to see if you're accepting help/contributions for this issue. I noticed that 11ty's Liquid engine is currently only using moo in two places: eleventy/src/Engines/Liquid.js Line 24 in 0f44f75
eleventy/src/Engines/Liquid.js Line 100 in 0f44f75
By size of the change, do you mean that it's high impact, or are there other changes that would need to be made as well? |
@zachleat Any thoughts on @AleksandrHovhannisyan's question above? Would you be interested in contributions for this issue? Thanks! |
Starting in Eleventy v3.0.0-alpha.18 and newer you can use
|
Related: harttle/liquidjs#724 |
Temporary docs preview URL deploying here: https://11ty-website-git-v3-11ty.vercel.app/docs/languages/liquid/#shortcode-parameter-parsing |
Could the documentation include an example of a Liquid shortcode that uses named parameters? I can't get it to work with: eleventyConfig.setLiquidParameterParsing("builtin"); // in the config
eleventyConfig.addShortcode("example", function (name, age) {
return `<p>Name: ${name}, Age: ${age}</p>`;
}); // in the config, later
{% example name: "abc", age: 3 %} // in the markdown file
and I wonder if I'm doing something wrong. Particularly, I'm not sure what the function definition of the shortcode should look like: multiple parameters, a dictionary, something else? The parameters |
https://liquidjs.com/tutorials/parse-parameters.html#Parse-Parameters-as-Values
https://liquidjs.com/tutorials/parse-parameters.html#Parse-Key-Value-Pairs-as-Named-Parameters
Currently implementation predated those features and is using a one-off parser using
moo
: https://github.com/11ty/eleventy/blob/0f44f756a30247515033945e74e171a293bc75d5/src/Engines/Liquid.jsI think due to the size of this change, we’ll probably want a configuration escape hatch for folks to swap back to the old parameter parser
Excellent prior art #1263 #1733
The text was updated successfully, but these errors were encountered: