Liquid & separating shortcode params to separate lines
Operating system
macOS Sonoma 14.5
Eleventy
2.0.1
Describe the bug
When using Liquid as the template engine, I am unable to split the shortcode arguments into multiple lines. For example, given a shortcode with the following signature:
eleventyConfig.addShortcode("image", function (src, alt, caption) { ... });
Everything works fine if I use this shortcode in a .liquid
file like this:
{% image 'src' 'alt' 'caption' %}
But if I add line breaks and line breaks separators (for readability) like so:
{% image
, 'src'
, 'alt'
, 'caption'
%}
I get an error from eleventy:
[11ty] 1. Having trouble rendering liquid template ./src/pages/index.liquid (via TemplateContentRenderError)
[11ty] 2. invalid syntax at line 1 col 8:
[11ty]
[11ty] 1 , 'src'
[11ty] ^
[11ty] 2 , 'alt'
[11ty] 3 , 'caption', file:./src/pages/index.liquid, line:17, col:5 (via RenderError)
[11ty] 3. invalid syntax at line 1 col 8:
[11ty]
[11ty] 1 , 'src'
[11ty] ^
[11ty] 2 , 'alt'
[11ty] 3 , 'caption' (via Error)
[11ty]
[11ty] Original error stack trace: Error: invalid syntax at line 1 col 8:
[11ty]
[11ty] 1 , 'src'
[11ty] ^
[11ty] 2 , 'alt'
[11ty] 3 , 'caption'
[11ty] at Lexer._token (.../node_modules/moo/moo.js:559:17)
[11ty] at Lexer.next (.../node_modules/moo/moo.js:506:19)
[11ty] at Liquid.parseArguments (...node_modules/@11ty/eleventy/src/Engines/Liquid.js:146:21)
[11ty] at Tag.render (.../node_modules/@11ty/eleventy/src/Engines/Liquid.js:162:32)
[11ty] at render.next (<anonymous>)
[11ty] at toPromise (.../node_modules/liquidjs/dist/liquid.node.cjs.js:451:32)
[11ty] at toPromise (.../node_modules/liquidjs/dist/liquid.node.cjs.js:457:25)
[11ty] at async toPromise (.../node_modules/liquidjs/dist/liquid.node.cjs.js:459:25)
[11ty] at async Template._render (.../node_modules/@11ty/eleventy/src/TemplateContent.js:514:22)
[11ty] at async Template.renderWithoutLayout (.../node_modules/@11ty/eleventy/src/Template.js:456:27)
Is there a reason why this format should not be supported? AFAIK it is a standard liquid formatting style.