Skip to content

Commit

Permalink
Consider <html> a block-level HTML element (#1309)
Browse files Browse the repository at this point in the history
  • Loading branch information
kernc committed Dec 2, 2022
1 parent e3604b4 commit a8ad6fc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 14 deletions.
1 change: 1 addition & 0 deletions docs/change_log/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Python-Markdown Change Log
*under development*: version 3.4.1 (a bug-fix release).

* Improve standalone * and _ parsing (#1300).
* Consider `<html>` HTML tag a block-level element (#1309).

July 15, 2022: version 3.4.1 (a bug-fix release).

Expand Down
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', '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
4 changes: 2 additions & 2 deletions markdown/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@
'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', 'body', 'dt', 'group', 'iframe', 'li', 'legend',
'canvas', 'colgroup', 'dd', 'body', 'dt', 'group', 'html', '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 a8ad6fc

Please sign in to comment.