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

Function markdown

markdown/core.py:484–509  ·  view source on GitHub ↗

Convert a markdown string to HTML and return HTML as a Unicode string. This is a shortcut function for [`Markdown`][markdown.Markdown] class to cover the most basic use case. It initializes an instance of [`Markdown`][markdown.Markdown], loads the necessary extensions and runs the

(text: str, **kwargs: Any)

Source from the content-addressed store, hash-verified

482
483
484def markdown(text: str, **kwargs: Any) -> str:
485 """
486 Convert a markdown string to HTML and return HTML as a Unicode string.
487
488 This is a shortcut function for [`Markdown`][markdown.Markdown] class to cover the most
489 basic use case. It initializes an instance of [`Markdown`][markdown.Markdown], loads the
490 necessary extensions and runs the parser on the given text.
491
492 Arguments:
493 text: Markdown formatted text as Unicode or ASCII string.
494
495 Keyword arguments:
496 **kwargs: Any arguments accepted by the Markdown class.
497
498 Returns:
499 A string in the specified output format.
500
501 !!! warning
502 The Python-Markdown library does ***not*** sanitize its HTML output.
503 If you are processing Markdown input from an untrusted source, it is your
504 responsibility to ensure that it is properly sanitized. For more
505 information see [Sanitizing HTML Output](../../sanitization.md).
506
507 """
508 md = Markdown(**kwargs)
509 return md.convert(text)
510
511
512def markdownFromFile(**kwargs: Any):

Callers 1

testMethod · 0.90

Calls 2

convertMethod · 0.95
MarkdownClass · 0.85

Tested by 1

testMethod · 0.72