Skip to content

Commit d6018cd

Browse files
committed
Refer to BLOCK_LEVEL_ELEMENTS list to avoid discrepancies
1 parent e306518 commit d6018cd

File tree

2 files changed

+3
-13
lines changed

2 files changed

+3
-13
lines changed

markdown/core.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
from .postprocessors import build_postprocessors
3232
from .extensions import Extension
3333
from .serializers import to_html_string, to_xhtml_string
34+
from .util import BLOCK_LEVEL_ELEMENTS
3435

3536
__all__ = ['Markdown', 'markdown', 'markdownFromFile']
3637

@@ -72,18 +73,7 @@ def __init__(self, **kwargs):
7273
self.ESCAPED_CHARS = ['\\', '`', '*', '_', '{', '}', '[', ']',
7374
'(', ')', '>', '#', '+', '-', '.', '!']
7475

75-
self.block_level_elements = [
76-
# Elements which are invalid to wrap in a `<p>` tag.
77-
# See https://w3c.github.io/html/grouping-content.html#the-p-element
78-
'address', 'article', 'aside', 'blockquote', 'details', 'div', 'dl',
79-
'fieldset', 'figcaption', 'figure', 'footer', 'form', 'h1', 'h2', 'h3',
80-
'h4', 'h5', 'h6', 'header', 'hgroup', 'hr', 'main', 'menu', 'nav', 'ol',
81-
'p', 'pre', 'section', 'table', 'ul',
82-
# Other elements which Markdown should not be mucking up the contents of.
83-
'canvas', 'colgroup', 'dd', 'html', 'body', 'dt', 'group', 'iframe', 'li', 'legend',
84-
'math', 'map', 'noscript', 'output', 'object', 'option', 'progress', 'script',
85-
'style', 'summary', 'tbody', 'td', 'textarea', 'tfoot', 'th', 'thead', 'tr', 'video'
86-
]
76+
self.block_level_elements = BLOCK_LEVEL_ELEMENTS
8777

8878
self.registeredExtensions = []
8979
self.docType = ""

markdown/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
# Other elements which Markdown should not be mucking up the contents of.
4444
'canvas', 'colgroup', 'dd', 'html', 'body', 'dt', 'group', 'iframe', 'li', 'legend',
4545
'math', 'map', 'noscript', 'output', 'object', 'option', 'progress', 'script',
46-
'style', 'tbody', 'td', 'textarea', 'tfoot', 'th', 'thead', 'tr', 'video'
46+
'style', 'summary', 'tbody', 'td', 'textarea', 'tfoot', 'th', 'thead', 'tr', 'video'
4747
]
4848

4949
# Placeholders

0 commit comments

Comments
 (0)