diff options
Diffstat (limited to 'markdown')
-rw-r--r-- | markdown/extensions/admonition.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/markdown/extensions/admonition.py b/markdown/extensions/admonition.py index 8576638..b001957 100644 --- a/markdown/extensions/admonition.py +++ b/markdown/extensions/admonition.py @@ -41,7 +41,8 @@ class AdmonitionProcessor(BlockProcessor): CLASSNAME = 'admonition' CLASSNAME_TITLE = 'admonition-title' - RE = re.compile(r'(?:^|\n)!!! ?([\w\-]+)(?: +"(.*?)")? *(?:\n|$)') + RE = re.compile(r'(?:^|\n)!!! ?([\w\-]+(?: +[\w\-]+)*)(?: +"(.*?)")? *(?:\n|$)') + RE_SPACES = re.compile(' +') def test(self, parent, block): sibling = self.lastChild(parent) @@ -80,11 +81,12 @@ class AdmonitionProcessor(BlockProcessor): def get_class_and_title(self, match): klass, title = match.group(1).lower(), match.group(2) + klass = self.RE_SPACES.sub(' ', klass) if title is None: # no title was provided, use the capitalized classname as title # e.g.: `!!! note` will render # `<p class="admonition-title">Note</p>` - title = klass.capitalize() + title = klass.split(' ', 1)[0].capitalize() elif title == '': # an explicit blank title should not be rendered # e.g.: `!!! warning ""` will *not* render `p` with a title |