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

Function markdown

markdown/core.py:493–518  ·  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

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

Callers 1

testMethod · 0.90

Calls 2

convertMethod · 0.95
MarkdownClass · 0.85

Tested by 1

testMethod · 0.72