Line breaks in preview
CompletedHi there –
I am noticing that preview within the app treats line breaks differently than preview with Marked 2 (namely, lines followed what Marked shows as a new line frequently is not shown as a new line in nvUltra). What is the difference?
-
Can you give an example?
0 -
Here is an example: one image is the text in NVUltra (with invisible characters showing) and its preview; the other – preview in Marked.

0 -
Brett will have to speak to what Marked is doing with its preview. My guess is that you have the "Retain linebreaks in paragraphs" preference enabled?
From what you're showing, the nvUltra preview is correct. The lines have a single newline in them, which in Markdown does not trigger a line break in the HTML. If you want a line break, you can use `<space><space><newline>` or `\<newline>` to indicate that you want a linebreak in the output.
The first option is standard Markdown, and should work anywhere that Markdown is properly supported. The second option is part of MultiMarkdown, and should also work anywhere that MultiMarkdown is properly supported.
0 -
Ah, indeed, I do have the setting in Marked enabled. Mystery solved. If the setting makes its way into nvUltra as well, it would be super, but if not, I'll stick with Marked for documents for which the setting makes sense. Thanks.
0 -
At least for now, Brett and I are going to stick with the expectation that nvUltra "follows the rules" in terms of Markdown and MultiMarkdown. So there won't be a preference that goes against the MultiMarkdown syntax, or the Markdown syntax (as implemented in MMD's compatibility mode), such as the "Retain linebreaks in paragraphs" preference that is used in Marked.
This helps in a couple of ways:
- The expected behavior of nvUltra should be clear from the MD/MMD syntax and test suites. If unexpected behavior arises, it is likely either a bug, or a previously unidentified edge case.
- The documents you create with nvUltra should work as expected anywhere that MMD is properly supported, and anywhere that MD is properly supported (assuming you don't use and MMD features).
There may be specific instances where we need to go against this decision, but hopefully that will be exceedingly rare, if ever.
0 -
I agree, and there are other preview options for other use cases.
0 -
Thanks!
0 -
And you can always use Marked 2 as your external previewer :).
0
Please sign in to leave a comment.
Comments
8 comments