sembr / specification

Semantic Line Breaks Specification
https://sembr.org
75 stars 5 forks source link

on em-dashes #4

Open goretkin opened 3 years ago

goretkin commented 3 years ago

In e.g. markdown, depending on what convention is used for spaces around em-dash, you can get different results after applying semantic line breaks. It seems that that dictates using spaces around em-dashes in the source. Perhaps this can be mentioned.

sentence-per-line, no em-dash spaces:

The food—which was delicious—reminded me of home.
The food, which was delicious, reminded me of home.

clause-per-line, inconsistent em-dash spaces:

The food
—which was delicious—
reminded me of home.
The food,
which was delicious,
reminded me of home.

I could instead use

sentence-per-line, em-dash spaces:

The food — which was delicious — reminded me of home.

and

clause-per-line, em-dash spaces:

The food
— which was delicious —
reminded me of home.

which render the same as each other and make the em-dash spacing situation consistent with the comma situation.

Gist of four snippets, with rendering: https://gist.github.com/goretkin/ab383aafaac4aa08d057b1c48fd196fd (github issues use a flavor of markdown that does not support semantic line breaks)

mtsknn commented 3 years ago

I have been thinking about this too.

Em-dashes are usually not surrounded by spaces. See:

It's unfortunate that em-dashes without spaces don't work well with semantic line breaks. On the other hand, the specification recommends adding a line break after an em-dash:

A semantic line break SHOULD occur after an independent clause as punctuated by a comma (,), semicolon (;), colon (:), or em dash (—).

So yea, perhaps this should be clarified. I'm not sure how.

I personally use en-dashes surrounded by spaces and wrap my code like this:

The food –
which was delicious –
reminded me of home.

I think en-dashes with spaces read better on the web than em-dashes without spaces. The spec doesn't mention en-dashes at all – perhaps it should?