MCPcopy Index your code
hub / github.com/Python-Markdown/markdown / markdownFromFile

Function markdownFromFile

markdown/core.py:505–531  ·  view source on GitHub ↗

Read Markdown text from a file or stream and write HTML output to a file or stream. This is a shortcut function which initializes an instance of [`Markdown`][markdown.Markdown], and calls the [`convertFile`][markdown.Markdown.convertFile] method rather than [`convert`][markdown.Mar

(**kwargs: Any)

Source from the content-addressed store, hash-verified

503
504
505def markdownFromFile(**kwargs: Any):
506 """
507 Read Markdown text from a file or stream and write HTML output to a file or stream.
508
509 This is a shortcut function which initializes an instance of [`Markdown`][markdown.Markdown],
510 and calls the [`convertFile`][markdown.Markdown.convertFile] method rather than
511 [`convert`][markdown.Markdown.convert].
512
513 Keyword arguments:
514 input (str | BinaryIO): A file name or readable object.
515 output (str | BinaryIO): A file name or writable object.
516 encoding (str): Encoding of input and output.
517 **kwargs: Any arguments accepted by the `Markdown` class.
518
519 !!! warning
520 The Python-Markdown library does ***not*** sanitize its HTML output.
521 As `markdown.markdownFromFile` writes directly to the file system, there is no
522 easy way to sanitize the output from Python code. Therefore, it is
523 recommended that the `markdown.markdownFromFile` function not be used on input
524 from an untrusted source. For more information see [Sanitizing HTML
525 Output](../../sanitization.md).
526
527 """
528 md = Markdown(**kwargs)
529 md.convertFile(kwargs.get('input', None),
530 kwargs.get('output', None),
531 kwargs.get('encoding', None))

Callers

nothing calls this directly

Calls 2

convertFileMethod · 0.95
MarkdownClass · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…