Creates a new Markdown instance. Keyword Arguments: extensions (list[Extension | str]): A list of extensions. If an item is an instance of a subclass of [`markdown.extensions.Extension`][], the instance will be used as-is. If an item is
(self, **kwargs)
| 86 | """ |
| 87 | |
| 88 | def __init__(self, **kwargs): |
| 89 | """ |
| 90 | Creates a new Markdown instance. |
| 91 | |
| 92 | Keyword Arguments: |
| 93 | extensions (list[Extension | str]): A list of extensions. |
| 94 | |
| 95 | If an item is an instance of a subclass of [`markdown.extensions.Extension`][], |
| 96 | the instance will be used as-is. If an item is of type `str`, it is passed |
| 97 | to [`build_extension`][markdown.Markdown.build_extension] with its corresponding |
| 98 | `extension_configs` and the returned instance of [`markdown.extensions.Extension`][] |
| 99 | is used. |
| 100 | extension_configs (dict[str, dict[str, Any]]): Configuration settings for extensions. |
| 101 | output_format (str): Format of output. Supported formats are: |
| 102 | |
| 103 | * `xhtml`: Outputs XHTML style tags. Default. |
| 104 | * `html`: Outputs HTML style tags. |
| 105 | tab_length (int): Length of tabs in the source. Default: `4` |
| 106 | |
| 107 | """ |
| 108 | |
| 109 | self.tab_length: int = kwargs.get('tab_length', 4) |
| 110 | |
| 111 | self.ESCAPED_CHARS: list[str] = [ |
| 112 | '\\', '`', '*', '_', '{', '}', '[', ']', '(', ')', '>', '#', '+', '-', '.', '!' |
| 113 | ] |
| 114 | """ List of characters which get the backslash escape treatment. """ |
| 115 | |
| 116 | self.block_level_elements: list[str] = BLOCK_LEVEL_ELEMENTS.copy() |
| 117 | |
| 118 | self.registeredExtensions: list[Extension] = [] |
| 119 | self.docType = "" # TODO: Maybe delete this. It does not appear to be used anymore. |
| 120 | self.stripTopLevelTags: bool = True |
| 121 | |
| 122 | self.build_parser() |
| 123 | |
| 124 | self.references: dict[str, tuple[str, str]] = {} |
| 125 | self.htmlStash: util.HtmlStash = util.HtmlStash() |
| 126 | self.registerExtensions(extensions=kwargs.get('extensions', []), |
| 127 | configs=kwargs.get('extension_configs', {})) |
| 128 | self.set_output_format(kwargs.get('output_format', 'xhtml')) |
| 129 | self.reset() |
| 130 | |
| 131 | def build_parser(self) -> Markdown: |
| 132 | """ |
nothing calls this directly
no test coverage detected