diff --git a/lib/markdown2.py b/lib/markdown2.py index 86876ab5..cba1580b 100755 --- a/lib/markdown2.py +++ b/lib/markdown2.py @@ -2759,7 +2759,7 @@ def sub(self, match): tags = self.tags(lexer_name) - return "\n%s%s%s\n%s\n" % (leading_indent, tags[0], codeblock, tags[1]) + return "\n%s%s%s\n%s%s\n" % (leading_indent, tags[0], codeblock, leading_indent, tags[1]) def run(self, text): return self.fenced_code_block_re.sub(self.sub, text) diff --git a/test/tm-cases/fenced_code_blocks_simple.html b/test/tm-cases/fenced_code_blocks_simple.html index 7d05a72f..e1889052 100644 --- a/test/tm-cases/fenced_code_blocks_simple.html +++ b/test/tm-cases/fenced_code_blocks_simple.html @@ -12,3 +12,16 @@
    is indentation maintained?
 
+ +

Here's one in a list, with another one following (see #580):

+ + + +
code 3
+
diff --git a/test/tm-cases/fenced_code_blocks_simple.text b/test/tm-cases/fenced_code_blocks_simple.text index 9f2aabad..76efcdd1 100644 --- a/test/tm-cases/fenced_code_blocks_simple.text +++ b/test/tm-cases/fenced_code_blocks_simple.text @@ -14,3 +14,16 @@ Here is one at the end of the file: ``` is indentation maintained? ``` + +Here's one in a list, with another one following (see #580): + +* List 1 + ``` + code 1 + + code 2 + ``` + +``` +code 3 +```