MCPcopy
hub / github.com/Python-Markdown/markdown / markdown

Function markdown

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

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

Callers 1

testMethod · 0.90

Calls 2

convertMethod · 0.95
MarkdownClass · 0.85

Tested by 1

testMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…