MCPcopy Index your code
hub / github.com/ronreiter/interactive-tutorials / markdown

Function markdown

markdown/__init__.py:568–598  ·  view source on GitHub ↗

Convert a markdown string to HTML and return HTML as a unicode string. This is a shortcut function for `Markdown` class to cover the most basic use case. It initializes an instance of Markdown, loads the necessary extensions and runs the parser on the given text. Keyword arguments

(text,
             extensions = [],
             safe_mode = False,
             output_format = DEFAULT_OUTPUT_FORMAT)

Source from the content-addressed store, hash-verified

566"""
567
568def markdown(text,
569 extensions = [],
570 safe_mode = False,
571 output_format = DEFAULT_OUTPUT_FORMAT):
572 """Convert a markdown string to HTML and return HTML as a unicode string.
573
574 This is a shortcut function for `Markdown` class to cover the most
575 basic use case. It initializes an instance of Markdown, loads the
576 necessary extensions and runs the parser on the given text.
577
578 Keyword arguments:
579
580 * text: Markdown formatted text as Unicode or ASCII string.
581 * extensions: A list of extensions or extension names (may contain config args).
582 * safe_mode: Disallow raw html. One of "remove", "replace" or "escape".
583 * output_format: Format of output. Supported formats are:
584 * "xhtml1": Outputs XHTML 1.x. Default.
585 * "xhtml": Outputs latest supported version of XHTML (currently XHTML 1.1).
586 * "html4": Outputs HTML 4
587 * "html": Outputs latest supported version of HTML (currently HTML 4).
588 Note that it is suggested that the more specific formats ("xhtml1"
589 and "html4") be used as "xhtml" or "html" may change in the future
590 if it makes sense at that time.
591
592 Returns: An HTML document as a string.
593
594 """
595 md = Markdown(extensions=load_extensions(extensions),
596 safe_mode=safe_mode,
597 output_format=output_format)
598 return md.convert(text)
599
600
601def markdownFromFile(input = None,

Callers

nothing calls this directly

Calls 3

convertMethod · 0.95
MarkdownClass · 0.85
load_extensionsFunction · 0.85

Tested by

no test coverage detected