lukeed/tidyPublic

fix: lay out Liquid like Prettier

Prettier's parser reads `{{ ... }}` and `{% ... %}` (Liquid, and
Hugo shortcodes) as nodes of their own; a tag alone on a line is a
block. pulldown-cmark reads them as paragraph text, so mdtidy keeps
that reading and copies Prettier's layout where it is safe:

- No blank line between a paragraph that ends or starts with a Liquid
  line and the block right beside it.
- A Liquid line written lazily, at the left margin inside a list item
  or quote, stays there, with the lazy lines after it.
- After a Liquid line, a line that starts an HTML block keeps the rest
  of the paragraph as written, indents included.
- When wrapping, a line break next to a Liquid line stays, and a
  Liquid tag is never broken inside.
LELuke Edwards authored
416d4a3Patch
Parent827f970
5 files changed+221-14
StackedSplit
crates/tidy/src/markdown/opener.rs+53 −0
crates/tidy/src/markdown/wrap.rs+26 −2
crates/tidy/src/markdown/writer/liquid.rs+71 −0
crates/tidy/src/markdown/writer/mod.rs+46 −12
crates/tidy/tests/markdown.rs+25 −0