MCPcopy Create free account
hub / github.com/Python-Markdown/markdown / is_block_level

Method is_block_level

markdown/core.py:302–313  ·  view source on GitHub ↗

Check if the given `tag` is a block level HTML tag. Returns `True` for any string listed in `Markdown.block_level_elements`. A `tag` which is not a string always returns `False`.

(self, tag: Any)

Source from the content-addressed store, hash-verified

300 # Note: the `tag` argument is type annotated `Any` as ElementTree uses many various objects as tags.
301 # As there is no standardization in ElementTree, the type of a given tag is unpredictable.
302 def is_block_level(self, tag: Any) -> bool:
303 """
304 Check if the given `tag` is a block level HTML tag.
305
306 Returns `True` for any string listed in `Markdown.block_level_elements`. A `tag` which is
307 not a string always returns `False`.
308
309 """
310 if isinstance(tag, str):
311 return tag.lower().rstrip('/') in self.block_level_elements
312 # Some ElementTree tags are not strings, so return False.
313 return False
314
315 def convert(self, source: str) -> str:
316 """

Callers 7

handle_starttagMethod · 0.80
handle_startendtagMethod · 0.80
isblocklevelMethod · 0.80
_prettifyETreeMethod · 0.80
runMethod · 0.80
handle_startendtagMethod · 0.80

Calls

no outgoing calls

Tested by 1