yogthos / markdown-clj

Markdown parser in Clojure
Eclipse Public License 1.0
540 stars 120 forks source link

Newlines inside anchors does not work #158

Open cjohansen opened 4 years ago

cjohansen commented 4 years ago

If you have a newline in the link text of a markdown link, the parser spits it out verbatim:

[Here is a long
link text](/page)

This is rendered as is in HTML.

yogthos commented 4 years ago

that's actually documented limitation at the moment https://github.com/yogthos/markdown-clj#limitations

cjohansen commented 4 years ago

I see. Would you be interested in a PR to fix it? It seems to me that parsing paragraph by paragraph would solve both this and my other issue?

yogthos commented 4 years ago

Sure, a PR would be most welcome.

cjohansen commented 4 years ago

Ok, I'll see what I find the time for :) I have lots of markdown files, and fixing the issue would probably be easier than looking over the files... But I don't know anything about the implementation, so maybe I'm wrong :)

yogthos commented 4 years ago

It shouldn't be too bad to fix in theory. You'd basically just want to preprocess the input to read contiguous chunks instead of single lines. Also, you might want to take a look at using flexmark instead. Here's an example calling it from Clojure.