Compatibility with whitespace handling in Jekyll: trim file on {% include %} #521
Replies: 3 comments
-
Hey @Nowaker , we can treat this as a bugfix for Jekyll include. As for
|
Beta Was this translation helpful? Give feedback.
-
That's a fantastic idea! |
Beta Was this translation helpful? Give feedback.
-
I created a demo for this on Jekyll: https://github.com/harttle/jekyll-include-demo The _layouts/foo.liquid included _includes/b.liquid which has leading & trailing spaces and new lines. It turns out, in this demo, the leading & trailing spaces and new lines of the included file are preserved: |
Beta Was this translation helpful? Give feedback.
-
On
{% include blah.html %}
, Jekyll start-trims (removes leading whitespace) from the referenced file - equivalent offs.fileReadSync('blah.html').trimStart()
- before embedding it into the output.I'd like to ask for a new option(s) for https://liquidjs.com/tutorials/whitespace-control.html#via-Options:
trimIncludeLeft
&trimIncludeRight
trimLayoutLeft
&trimLayoutRight
- note: Jekyll useslayout: blah
in front matter for layouts, so I never used{% layout %}
in my project, so I will not use it, but it may make sense to include it for consistency withtrimIncludes
Because
{% include %}
is a built-in tag, I wasn't able to tune it to ensure Jekyll compatibility.FYI: My Jekyll-in-Gatsby project is now almost complete, with whitespace being the only difference between the builds.
Beta Was this translation helpful? Give feedback.
All reactions