diff --git a/markdown_it/rules_block/code.py b/markdown_it/rules_block/code.py index ed8ad24e..6d9c87a3 100644 --- a/markdown_it/rules_block/code.py +++ b/markdown_it/rules_block/code.py @@ -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 diff --git a/tests/test_port/test_no_end_newline.py b/tests/test_port/test_no_end_newline.py index 42478dfe..b35423e1 100644 --- a/tests/test_port/test_no_end_newline.py +++ b/tests/test_port/test_no_end_newline.py @@ -17,6 +17,7 @@ ("

", "

"), ("p", "

p

\n"), ("[reference]: /url", ""), + (" indented code block", "
indented code block\n
\n"), ], ) def test_no_end_newline(input, expected):