(edited to add: It wouldn't really be an issue if prettier had some config options for not mangling whitespace, but that ship seems to have sailed for some reason.)
(edited to add: It wouldn't really be an issue if prettier had some config options for not mangling whitespace, but that ship seems to have sailed for some reason.)
Please stop doing that, prettier.
Nobody is running prettier on their code or markup for the benefit of the computer. If it's not readable, it's just a bad formatting tool (or wasn't configured properly). The whole point of a formatter is to make it easier to read.
const matrix = [
1, 0, 0,
0, 1, 0,
0, 0, 1,
]
and collapse it onto one line. But their view is that reformatting everything from scratch is more important that such things, and that it's reasonable to add /* ignore */ comments to every single place where you want anything preserved.The stated philosophy behind Prettier is to end arguments within a team about how to format code, which... Given Markdown is already heavily constrained, barely applies; unlike other languages supported by Prettier, there are precious few adjustments made to Markdown that are clearly intentionally made in pursuit of consistent readability - indeed, if I recall correctly the Prettier Markdown engine is mostly just a round-trip through the remark.js parser and stringifier, and the results reflect this - the results look mechanical, and it is just as likely to eliminate whitespace that lends clarity as it is to add it (if not, as the GP suggests, more likely).
Sadly, there are remark.js plugins that could have been used to e.g. enforce consistent use of whitespace without stripping everything down to the bare minimum, but last I looked the Prettier folk were pretty hostile toward any suggestions that their (default, bare-minimum-effort) "style" was at all problematic.
Which is to say there isn’t any such thing as “source Markdown” and “rendered Markdown”. Markdown is the source, HTML is the output, although you can make your own parser output to whatever you want.
There is no "source markdown". Markdown is meant to be formatted to be read, without any intermediate step. "Prettifiers" like github etc are just converting the markdown into "styled" text. The format was always meant to be read as is.
> "Markdown is intended to be as easy-to-read and easy-to-write as is feasible. Readability, however, is emphasized above all else. A Markdown-formatted document should be publishable as-is, as plain text, without looking like it’s been marked up with tags or formatting instructions."
...Arguably, the reason HTML has collapsible whitespace is to allow writing readable source, and once upon a time it was more common to see HTML produced in a way that didn't get in the way of this (e.g. paragraphs and indentation indicated primarily via whitespace with only opening `<p>` and `<li>` tags). But that ship sailed; tooling long ago coalesced around more rigid conventions, and thus the need for Markdown emerged. Throwing those advantages away raises the question of why bother using Markdown at all.
> I’ve written a text-to-HTML formatting tool called Markdown
... which kinda suggests to me it's meant to be rendered.
Markdown's major advantage is that it's (mostly) readable as plaintext (essentially a graceful degradation), but evidenced by how most tools using it render Markdown into HTML instead of showing it unrendered, it doesn't seem like people prefer reading it.
The people who replied to you are saying that it's nonetheless (also) meant to be read as-is -- because that's relevant to whether or not a markdown formatter should try to preserve readability, which was the topic at hand.
Now the point is - markdown formatters only format things which won't have an effect in the rendered HTML, so why does it matter? Do you have some meaningful information encoded in markdown which does not translate to HTML? That sounds like a clear anti-pattern, since by rendering to HTML you lose it.
If it's relevant for you, great! This thread is me saying it ought to be configurable either way.
> so why does it matter?
Readability, per the whole thread.