Skip to content

Commit 1caf92b

Browse files
committed
Support 0-3 spaces of indent for raw HTML blocks
1 parent d021b3c commit 1caf92b

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

markdown/blockprocessors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ def run(self, parent, blocks):
278278

279279
class RawHtmlProcessor(BlockProcessor):
280280

281-
TAG_RE = re.compile(r'^\<(?P<tag>[^<> ]+)[^<>]*>')
281+
TAG_RE = re.compile(r'^[ ]{0,3}\<(?P<tag>[^<> ]+)[^<>]*>')
282282

283283
def test(self, parent, block):
284284
m = self.TAG_RE.match(block)

tests/test_syntax/blocks/test_html_blocks.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,19 @@ def test_raw_skip_inline_markdown(self):
4040
def test_raw_indent_one_space(self):
4141
self.assertMarkdownRenders(
4242
' <p>A *raw* paragraph.</p>',
43-
# TODO: reevaluate. This matches strict rules and reference
44-
# implementation version 1.0.1 but not 1.0.2b8.
45-
'<p><p>A <em>raw</em> paragraph.</p></p>'
43+
'<p>A *raw* paragraph.</p>'
44+
)
45+
46+
def test_raw_indent_two_spaces(self):
47+
self.assertMarkdownRenders(
48+
' <p>A *raw* paragraph.</p>',
49+
'<p>A *raw* paragraph.</p>'
50+
)
51+
52+
def test_raw_indent_three_spaces(self):
53+
self.assertMarkdownRenders(
54+
' <p>A *raw* paragraph.</p>',
55+
'<p>A *raw* paragraph.</p>'
4656
)
4757

4858
def test_raw_indent_four_spaces(self):

0 commit comments

Comments
 (0)