jgm / djot

A light markup language
https://djot.net
MIT License
1.71k stars 43 forks source link

Add ability to suppress spaces in soft line breaks #194

Open mcookly opened 1 year ago

mcookly commented 1 year ago

In my writing, I prefer to keep one independent clause (or interjection) per line. I also enjoy using em dashes. But because Markdown adds a space with a soft break, the rendered document contains spaces around the em dash (which is typical in newspapers but not academic writing). For example,

The quick brown fox
---who must be exhausted from all the jumping---
jumped over the lazy dog.

would render as:

The quick brown fox — who must be exhausted from all the jumping — jumped over the lazy dog.

Ideally, there would be a way to suppress these spaces, allowing the example above to be rendered as:

The quick brown fox—who must be exhausted from all the jumping—jumped over the lazy dog.

You can do this in LaTeX by adding a % at the end of a line. Is there potentially any way to designate this in Djot? This could also help with CJK text, which already has an issue opened. (See #131.) Another use case for this ability might be creating citations outside punctuation, as Chicago style dictates. Thus you could have the citation itself be on a new line, separated from its sentence.

This is quite a low priority since these problems are easily worked around. Still, it would be nice to see the option to use line breaks in the source without having them converted to spaced soft breaks.

jgm commented 1 year ago

If we added a TeX-style line comment syntax https://github.com/jgm/djot/issues/67#issuecomment-1374540995 that could solve this.