Pine
Pine copied to clipboard
Support for backslash as hard line break
Please add support for hard line breaks with a backslash. See the example from GitHub Flavored Markdown Spec: https://github.github.com/gfm/#example-633
This is hard, since backslashes are used for math rendering too (e.g. \\ for newlines, \lambda and other symbols) which I would deem more commonly used than hard line breaks.
The problem is that when the markdown parser parses a string like \\ it escapes the second \ and the HTML returned only contains a single \. So for LaTeX functions like \lambda, the parser would return lambda without the required leading backslash.
To combat this, I replace any occurrence of \ (single backslash) with \\ (double backslash), so that after parsing is done the correct literal backslash \ is returned in the HTML.
Unfortunately without this replacement, all LaTeX functions with a leading backslash would not work. The side effect of this is that single \ backslash characters are rendered as literal \ characters in the preview, which breaks the feature you mention of hard line breaks.
To fix this I will need to introduce two new node types for inline and block math into the parser, for which backslashes are not escaped, so this bug might not get fixed for a while.