Skip to content
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

Add special "whitespace control" tag for nicely formatted output-html #925

Open
RoiEXLab opened this issue Aug 26, 2017 · 5 comments
Open

Comments

@RoiEXLab
Copy link

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!

@ashmaroli
Copy link
Contributor

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.

@pmackay
Copy link

pmackay commented Sep 10, 2018

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.

@spencertweedy
Copy link

Any developments here?

@daattali
Copy link

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)

@jmrplens
Copy link

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants