question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

HTML Beautify: do not format YAML front matter

See original GitHub issue

Static site generators like Assemble or Middleman or Jekyll are supporting YAML front matter at the top of a template. When running html beautify on these templates, the front matter gets messed up.

So this yaml front matter:


---
title: Test
is-test: true

---

converts to:

--- title: Test is-test: true ---

I would suggest to ignore everything “wrapped” between three dashes or to add an extra option.

Further information: http://assemble.io/docs/YAML.html or http://middlemanapp.com/basics/frontmatter/

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Reactions:2
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
Serhioromanocommented, Apr 20, 2017

I do believe that beautifier should have a parameter like preservenewlines . If it already have it then preserve new lines in the text. It is not only issue of front matter. For example let’s say there is HTML code and some people work in VS Code and other in MidnightCommander right on the server. that is why all text is formatted like this.

<p>
    This is multiple
    line text, that is
    easy to read in 
    MC
</p>

This works right when HTML is rendered and also visible in MC. But if someone format it with beautifier this is gone.

So preserve new lines in the text would be awesome.

0reactions
bitwisemancommented, Sep 12, 2018

I think this is fixed. Just needs a test.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Code formatting break Jekyll YAML front matter directives in ...
To resolve this, you have two options: Turned off formatting of HTML files in settings.json file: "html.format.enable": false.
Read more >
Prettier 1.15: HTML, Vue, Angular and MDX Support
Prettier can now format HTML, Vue and Angular files! ... Do not print wrong output if both front matter and /* prettier-ignore */...
Read more >
Markdown YAML front matter, Jekyll formatter, Md front matter, Jekyll ...
A YAML frontmatter, in Pandoc's terms "metadata block" is a series of meta variables that can be defined to describe information of the...
Read more >
YAML front matter - Assemble.io
This may not be obvious at first, is that YAML Front-Matter acts as a kind of "conduit" for passing information to pages via...
Read more >
tidy-markdown - npm
Format YAML front -matter and Markdown tables. Convert HTML elements into their Markdown equivalents. For example, <em>text</em> becomes _text_ .
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found