markdownify
Class info¶
Classes¶
| Name | Children | Inherits |
|---|---|---|
| MarkdownifyConverter mkconvert.converters.markdownify markdownify: pure-Python converter on top of BeautifulSoup, highly configurable. |
🛈 DocStrings¶
Converter using markdownify.
MarkdownifyConverter
¶
Bases: HtmlToMarkdownConverter
markdownify: pure-Python converter on top of BeautifulSoup, highly configurable.
Not supported: code_block_style="indented", code_fence="~~~",
link_style="reference".
Source code in src/mkconvert/converters/markdownify.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | |
__init__
¶
__init__(
options: HtmlToMarkdownOptions | None = None,
*,
on_unsupported: OnUnsupported = "warn",
bullets: str | None = None,
strip: Sequence[str] | None = None,
convert: Sequence[str] | None = None,
autolinks: bool = True,
default_title: bool = False,
code_language: str = "",
code_language_callback: Callable[[Any], str | None] | None = None,
escape_asterisks: bool = True,
escape_underscores: bool = True,
escape_misc: bool = False,
sub_symbol: str = "",
sup_symbol: str = "",
table_infer_header: bool = False,
wrap: bool = False,
wrap_width: int = 80,
strip_document: Literal["strip", "lstrip", "rstrip"] | None = "strip",
) -> None
Create a markdownify converter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
options
|
HtmlToMarkdownOptions | None
|
Common options. |
None
|
on_unsupported
|
OnUnsupported
|
See |
'warn'
|
bullets
|
str | None
|
Bullet markers per nesting level, e.g. |
None
|
strip
|
Sequence[str] | None
|
Tags to drop while keeping their content. |
None
|
convert
|
Sequence[str] | None
|
Only convert these tags (keeping the text of all others). |
None
|
autolinks
|
bool
|
|
True
|
default_title
|
bool
|
Use the URL as title of links without one. |
False
|
code_language
|
str
|
Language for fenced code blocks. |
''
|
code_language_callback
|
Callable[[Any], str | None] | None
|
Derive the language from the |
None
|
escape_asterisks
|
bool
|
Escape |
True
|
escape_underscores
|
bool
|
Escape |
True
|
escape_misc
|
bool
|
Escape other Markdown characters in text. |
False
|
sub_symbol
|
str
|
Wrap |
''
|
sup_symbol
|
str
|
Wrap |
''
|
table_infer_header
|
bool
|
Use the first row as table header if there is no |
False
|
wrap
|
bool
|
Wrap paragraphs at |
False
|
wrap_width
|
int
|
Line width for |
80
|
strip_document
|
Literal['strip', 'lstrip', 'rstrip'] | None
|
Strip whitespace around the result. |
'strip'
|