bootleg icon indicating copy to clipboard operation
bootleg copied to clipboard

markdown conversion looses dash when there's two subsequent ones

Open martinklepsch opened this issue 4 years ago • 2 comments

This

echo "[how to deal with promises](https://gist.github.com/roman01la/b939e4f2341fc2f931e34a941aba4e15#repl--asynchrony)" > bootleg-md-dash-omit.md
bootleg -e '(markdown "bootleg-md-dash-omit.md")'

breaks the link by omitting one of the dashes

<p><a href="https://gist.github.com/roman01la/b939e4f2341fc2f931e34a941aba4e15#repl–asynchrony">how to deal with promises</a></p>

This occurs regardless of whether the dashes are in the #anchor portion of the URL or the path itself.

Interestingly using markdown-clj I get a different result (v.1.10.0 as in project.clj):

(require '[markdown.core :as md])
(md/md-to-html-string "[how to deal with promises](https://gist.github.com/roman01la/b939e4f2341fc2f931e34a941aba4e15#repl--asynchrony)")
<p><a href='https://gist.github.com/roman01la/b939e4f2341fc2f931e34a941aba4e15#repl&ndash;asynchrony'>how to deal with promises</a></p>

cc @yogthos

martinklepsch avatar Feb 11 '21 11:02 martinklepsch

@martinklepsch It seems the double dash gets converted into a special character:

borkdude@MBP2019 /tmp $ bb -e '(int \–)'
8211
borkdude@MBP2019 /tmp $ bb -e '(int \-)'
45
`` 

borkdude avatar Feb 11 '21 11:02 borkdude

This is probably an issue in the underlying markdown-clj library. Ive noticed it also double layers indented list item markdown. ie.

 - foo
 - bar
 - baz

renders incorrectly (as a nested list), while

- foo
- bar
- baz

renders correctly. (first one is indented one space). I'll test both these on the upstream and file these bugs there, if so.

retrogradeorbit avatar Feb 26 '22 06:02 retrogradeorbit