liquid
liquid copied to clipboard
Add special "whitespace control" tag for nicely formatted output-html
Just a minor priority feature-request, but nonetheless nice to have: Imagine this common scenario: There is a basic layout file in jekyll like this:
<!DOCTYPE html>
<html>
<head>
<title>Some Title</title>
</head>
<body>
{{ content }}
</body>
</html>
If we have an HTML file using this layout like this:
---
layout: default
---
<div>
<span>Something</span>
</div>
The resulting html would be
<!DOCTYPE html>
<html>
<head>
<title>Some Title</title>
</head>
<body>
<div>
<span>Something</span>
</div>
</body>
</html>
although both files were nicely formatted. Even with the liquid 4 whitespace control, there's no way to effectively fix that.
My suggestion would be to add some sort of tag like {%?, ?%}, {{? and ?}} (or any other special character), which makes the inserted text have the space before this tag to the preceding newline char appended after every newline exect for the last one.
So the resulting output would be
<!DOCTYPE html>
<html>
<head>
<title>Some Title</title>
</head>
<body>
<div>
<span>Something</span>
</div>
</body>
</html>
like you would expect.
If I wasn't clear enough, or if you have some other questions about this request, please let me know!
I currently workaround this issue using a plugin called jekyll-tidy.. But it'd a be great to have this sorted out at Liquid itself.
I'm not even sure it should have a special tag, why not just make this the default behaviour? It would make sense for resolving #514 too.
Any developments here?
Another vote for this (I came here from #514 because it doesn't make sense that including files inside my <head> tag end up being less indented than the parent tag)
+1