diff options
-rw-r--r-- | markdown/extensions/admonition.py | 4 | ||||
-rw-r--r-- | tests/extensions/admonition.html | 8 | ||||
-rw-r--r-- | tests/extensions/admonition.txt | 8 |
3 files changed, 18 insertions, 2 deletions
diff --git a/markdown/extensions/admonition.py b/markdown/extensions/admonition.py index 76e0fb5..0c5ce46 100644 --- a/markdown/extensions/admonition.py +++ b/markdown/extensions/admonition.py @@ -41,7 +41,7 @@ class AdmonitionProcessor(BlockProcessor): CLASSNAME = 'admonition' CLASSNAME_TITLE = 'admonition-title' - RE = re.compile(r'(?:^|\n)!!!\ ?([\w\-]+)(?:\ "(.*?)")?') + RE = re.compile(r'(?:^|\n)!!! ?([\w\-]+)(?: +"(.*?)")? *(?:\n|$)') def test(self, parent, block): sibling = self.lastChild(parent) @@ -55,7 +55,7 @@ class AdmonitionProcessor(BlockProcessor): m = self.RE.search(block) if m: - block = block[m.end() + 1:] # removes the first line + block = block[m.end():] # removes the first line block, theRest = self.detab(block) diff --git a/tests/extensions/admonition.html b/tests/extensions/admonition.html index c900757..511d71a 100644 --- a/tests/extensions/admonition.html +++ b/tests/extensions/admonition.html @@ -28,4 +28,12 @@ </div> <div class="admonition tip"> <p>An explicitly empty string prevents the title from being rendered.</p> +</div> +<p>No body:</p> +<div class="admonition note"> +<p class="admonition-title">Note</p> +</div> +<p>Extra whitespace after the title should not alter output:</p> +<div class="admonition note"> +<p class="admonition-title">Note</p> </div>
\ No newline at end of file diff --git a/tests/extensions/admonition.txt b/tests/extensions/admonition.txt index d24336b..ab8434c 100644 --- a/tests/extensions/admonition.txt +++ b/tests/extensions/admonition.txt @@ -27,3 +27,11 @@ Not part of an Admonition! !!! tip "" An explicitly empty string prevents the title from being rendered. + +No body: + +!!! note + +Extra whitespace after the title should not alter output: + +!!! note |