problem with backticks in inline code at the start of a line
lucaswerkmeister opened this issue · 5 comments
Compare the result of the following markdown (use copy+paste – there’s a difference between 2. and 3.):
foo
`` `class Object` `` is a *meta literal*.
bar
foo
`` `class Object` `` is a *meta literal*.
bar
foo
`` `class Object` `` is a *meta literal*.
bar
(that’s a No-Break Space at the beginning of the second line)
4.
foo
other `` `class Object` `` is a *meta literal*.
bar
Here’s how the markdown is rendered by Github:
foo
class Object
is a meta literal.
bar
foo
class Object
is a meta literal.
bar
foo
class Object
is a meta literal.
bar
foo
otherclass Object
is a meta literal.
bar
(The line breaks are incorrect because GFM always inserts line breaks for newlines.)
And here’s how the markdown is rendered by txtmark (as used by ceylon doc
):
foo
bar
foo
bar
foo
class Object
is a meta literal. bar
foo other
class Object
is a meta literal. bar
That is, if a line starts with nothing other than spaces (meaning the identity of U+0020, not the Unicode category “Separator, Space [Zs]”, which also contains the No-Break Space U+00A0 as seen in 3.) and then a multi-backtick code block containing backticks `code` with backticks`
, then strange behavior occurs.
(originally reported as ceylon/ceylon-compiler#1553)
I just tried the code snippets you provided using the latest txtmark, and these are the results:
foo
`class Object`
is a meta literal.
bar
foo
`class Object`
is a meta literal.
bar
foo
`class Object`
is a meta literal.
bar
foo
other `class Object`
is a meta literal.
bar
which looks fine to me.
Do you have any code changes? Custom emitters? Or do you use the extended profile?
Ah, it's related to the extended profile and 'fenced code blocks', I'll see what's going on there.
To be exact, it's this line here: https://github.com/rjeschke/txtmark/blob/master/src/main/java/com/github/rjeschke/txtmark/Line.java#L269
I could change the fence line to have consecutive backticks and don't allow any spaces between the starting ones ... don't know if this will break something, though.
I will add a flag to the Configuration
to enable/disable spaces in fenced code blocks. This will allow to fix this issue without destroying compatibility.