Question: An extra blank line at the end of the code block #685
-
I use
The html generated during the process is as follows:
The markdown generated at the end is as follows:
I have an extra blank line at the end of a code block. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Good question! The CommonMark spec says:
Because There is no built-in way to remove that trailing newline character, but you could implement a custom event listener that listens for the |
Beta Was this translation helpful? Give feedback.
Good question! The CommonMark spec says:
Because
hogehoge
is followed by a newline character before the final fence, that newline gets included.There is no built-in way to remove that trailing newline character, but you could implement a custom event listener that listens for the
DocumentParsedEvent
, walks the AST looking forFencedCode
notes, and then perform anrtrim()
on the contents. Unfortunately, 1.x doesn't provide functionality to modify those contents, but 2.0 will! For 1.x you'd instead need to implement a custom renderer forFencedCode
objects and strip the trailing newline that way.