Skip to content

Commit

Permalink
Refer to BLOCK_LEVEL_ELEMENTS list to avoid discrepancies
Browse files Browse the repository at this point in the history
  • Loading branch information
kernc committed Dec 1, 2022
1 parent e306518 commit 85c3c11
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
14 changes: 2 additions & 12 deletions markdown/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
from .postprocessors import build_postprocessors
from .extensions import Extension
from .serializers import to_html_string, to_xhtml_string
from .util import BLOCK_LEVEL_ELEMENTS

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

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

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

self.registeredExtensions = []
self.docType = ""
Expand Down
2 changes: 1 addition & 1 deletion markdown/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
# Other elements which Markdown should not be mucking up the contents of.
'canvas', 'colgroup', 'dd', 'html', 'body', 'dt', 'group', 'iframe', 'li', 'legend',
'math', 'map', 'noscript', 'output', 'object', 'option', 'progress', 'script',
'style', 'tbody', 'td', 'textarea', 'tfoot', 'th', 'thead', 'tr', 'video'
'style', 'summary', 'tbody', 'td', 'textarea', 'tfoot', 'th', 'thead', 'tr', 'video'
]

# Placeholders
Expand Down

0 comments on commit 85c3c11

Please sign in to comment.