Extra whitespace for headers with level 2..6
SerVB opened this issue · comments
Sergei Bulgakov commented
Works OK for headers of level 1.
I've tried debugging it and noticed that it starts to differ here: InlineBuilder.kt-addRawTokens#L66. exitOffset
is passed always as +1
, but iterator.rawStart(rawIdx + dx) != exitOffset
when the header level is bigger than 1. I'm not sure how to to fix it so reporting.
To reproduce:
MarkdownParser(CommonMarkFlavourDescriptor()).buildMarkdownTreeFromString("# HEader TXT")
// gives correct tree, without whitespace:
// MARKDOWN_FILE
// * ATX_1
// ** ATX_HEADER
// ** ATX_CONTENT
// *** TEXT
// two or more hash symbols:
MarkdownParser(CommonMarkFlavourDescriptor()).buildMarkdownTreeFromString("## HEader TXT")
// gives incorrect tree, with redundant whitespace:
// MARKDOWN_FILE
// * ATX_2
// ** ATX_HEADER
// ** ATX_CONTENT
// *** WHITE_SPACE // <== here
// *** TEXT
Expected: the second tree is the same as the first one: without whitespaces.
Checked on 0.3.1 and 0.3.6.
Sergei Bulgakov commented
Looks resolved in 0.4.0. Now the behavior is the same across different header levels. A redundant whitespace can be removed from the user-side in the same way.