#2551 New line char after Markdown links

SlimerDude Wed 20 Jul 2016

fandoc::MarkdownDocWriter emits a new line character after every link:

// line 131
case DocNodeId.link:
  link := elem as Link
  out.print("](${link.uri})\n")

Could this be removed (?) so it's just:

out.print("](${link.uri})")

I know that single new lines are largely ignored in markdown, but:

  1. Links are inline, so the extraneous newlines in the generated markdown aren't expected
  2. The markup gets nebulous when dealing with lists

The second point in detail; I have the following fandoc:

1. Fantom [is]`http://fantom.org` cool

Converted to markdown with MarkdownDocWriter I get:

1. Fantom 
[is](http://fantom.org)
 cool

Because the markdown spec allows for hanging indents some markdown parsers discard the leading space before cool meaning the sentence gets rendered as

Fantom iscool

(Note how the words butt up against each other).

Other parsers / editors even keep the new line characters and show them as is!

I know the \n char in links isn't out right wrong, but unless I've missed a good reason to keep it, it would make my life a lot easier if it wasn't there!

For example, here's the above markdown snippet as rendered in the popular Stackedit.io online editor:

fantomTest.markdown

Which does not render as intended.

matthew Fri 22 Jul 2016

Ticket promoted to #2551 and assigned to matthew

matthew Fri 22 Jul 2016

Ticket resolved in 1.0.70

Thanks for the patch SlimerDude. The changeset includes a few fixes to other spurious spaces and newlines as well.

Login or Signup to reply.