Skip to content

Commit

Permalink
FIX: Always suffix indented code block with newline
Browse files Browse the repository at this point in the history
  • Loading branch information
hukkin committed Aug 17, 2021
1 parent 42e5732 commit 7e6324b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion markdown_it/rules_block/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def code(state: StateBlock, startLine: int, endLine: int, silent: bool = False):
state.line = last

token = state.push("code_block", "code", 0)
token.content = state.getLines(startLine, last, 4 + state.blkIndent, True)
token.content = state.getLines(startLine, last, 4 + state.blkIndent, False) + "\n"
token.map = [startLine, state.line]

return True
1 change: 1 addition & 0 deletions tests/test_port/test_no_end_newline.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
("<h1></h1>", "<h1></h1>"),
("p", "<p>p</p>\n"),
("[reference]: /url", ""),
(" indented code block", "<pre><code>indented code block\n</code></pre>\n"),
],
)
def test_no_end_newline(input, expected):
Expand Down

0 comments on commit 7e6324b

Please sign in to comment.