retrogradeorbit / bootleg

Simple template processing command line tool to help build static websites
Eclipse Public License 2.0
255 stars 12 forks source link

markdown conversion looses dash when there's two subsequent ones #73

Open martinklepsch opened 3 years ago

martinklepsch commented 3 years ago

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

borkdude commented 3 years ago

@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
`` 
retrogradeorbit commented 2 years ago

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.