DEV Community

Mika Feiler
Mika Feiler

Posted on

`-`, ‑, − — and Markdown? A rhethorical, and not, question about Markdown renderers.

In bare HTML, using - (regular hyphen) causes line-breaks to occur on them. Hence many place non-breaking hyphen Unicode character — which has but a numeric code and afaik no neat html entity code. Hyphen character is also what is used to represent a minus. Turns out that for minus there is HTML entity minus− (« − »).

See https://en.wikipedia.org/wiki/Wikipedia:Nonbreaking_hyphen for more about the issue.

But when using Markdown, we rarely think of the resulting HTML. Thus it could be maybe desired from Markdown renderers to take care of it for the user and let them just write the regular hyphen in the source code, by means of some heuristics~extensions — or are there rules in Markdown itself?

Do they do that, or do they not? Which do, which don't? How?

P.S. On the end of first paragraph i first wrote the name of entity in code quotes and then the whole entity code in code quotes — bc i don't really know if the Markdown renderer of devto will or will not sanitize code brackets from HTML entities, especially when it comes to a minus. Markdown is wild actually.

P.P.S. Ok, devto does do it, but idk if someones by-API reader will. (And yes, i know i can click preview, and just did it — this PPS was before publishing.)

Top comments (0)