commonmark / commonmark-java

Java library for parsing and rendering CommonMark (Markdown)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The markdown '---' can't transform to <hr>

JohnJyong opened this issue · comments

commented

Steps to reproduce the problem (provide example Markdown if applicable):
In markdown , we can use '* * * ' , '___' and '---' to generate dividing line . It seems that the commonmark only support transform "* * * " and ' ___ ' to ' hr ' label.

my markdown

---

Expected behavior:

transform to <hr >

expected HTML

<hr >

Actual behavior:

empty
actual HTML
empty

(Also see what the reference implementation does: https://spec.commonmark.org/dingus/)

Hm no, --- is supported too, see the specification: https://spec.commonmark.org/0.30/#thematic-breaks

This test is green too:

    @Test
    public void thematicBreak() {
        assertRendering("---\n", "<hr />\n");
    }

So that works. What is the text around --- in your case?

I wanted to add note to this old issue. Thematic break works if it's first line(like in test above) but not if it's somewhere in a middle and doesn't contain empty line before it.

Doesn't work:

hello
---
hello

Works:

hello

---
hello

Afaik, spec doesn't mention anything about empty lines around thematic break.