|
31 | 31 | from .postprocessors import build_postprocessors
|
32 | 32 | from .extensions import Extension
|
33 | 33 | from .serializers import to_html_string, to_xhtml_string
|
| 34 | +from .util import BLOCK_LEVEL_ELEMENTS |
34 | 35 |
|
35 | 36 | __all__ = ['Markdown', 'markdown', 'markdownFromFile']
|
36 | 37 |
|
@@ -72,18 +73,7 @@ def __init__(self, **kwargs):
|
72 | 73 | self.ESCAPED_CHARS = ['\\', '`', '*', '_', '{', '}', '[', ']',
|
73 | 74 | '(', ')', '>', '#', '+', '-', '.', '!']
|
74 | 75 |
|
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', '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.copy() |
87 | 77 |
|
88 | 78 | self.registeredExtensions = []
|
89 | 79 | self.docType = ""
|
|
0 commit comments