yogthos / markdown-clj

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

Newlines are not rendered correctly in line with "[]" #172

Closed borkdude closed 2 years ago

borkdude commented 2 years ago

Input as clojure block of code:

(let [x 1
      y "[]"
      ])

This renders as:

(let [x 1       y "[]"
      ])

It seems the "[]" string is triggering something weird.

yogthos commented 2 years ago

That looks like a bug, using ``` might be a workaround at the moment. Looks like might need a bit more intelligence here. If you have a chance to take a look a PR would be very welcome. :)

borkdude commented 2 years ago

@yogthos I am already using ``` at the moment, this is within such a block. I'm running into this while trying to rewrite my octopress blog in babashka using bootleg.

yogthos commented 2 years ago

Hmm, in theory the parser should avoid any processing when it's in the codeblock state.

borkdude commented 2 years ago

I'm noticing the quotes aren't relevant here either btw.

yogthos commented 2 years ago

Could it be something with the newline character?

borkdude commented 2 years ago

Oops, sorry to bother you, it was introduced by a workaround I did for another issue where I tried to support

[foo]
(https://bar)

on multiple lines which some markdown parsers do support. And this workaround caused the above bug.

yogthos commented 2 years ago

Ah no worries. :)

borkdude commented 2 years ago

It was actually this that I tried to support:

[Small Clojure
Interpreter](https://github.com/borkdude/sci)
yogthos commented 2 years ago

Oh yeah, that would take a bit of rework for the parser. Right now it considers input line by line, and I was thinking it might make sense to aggregate lines within paragraphs into a single line before doing the rest of processing. Never got around to doing it though. :)