mdfilters
Class info¶
🛈 DocStrings¶
autoref_link
¶
autoref_link(
text: str | None = None, link: str | ModuleType | Callable[..., Any] | None = None
) -> str
Create a markdown autorefs-style link (used by MkDocs / MkDocStrings).
If link is empty string or None, just the text will get returned.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text
|
str | None
|
Text to show for the link |
None
|
link
|
str | ModuleType | Callable[..., Any] | None
|
Target url |
None
|
Source code in src/jinjarope/mdfilters.py
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
|
extract_header_section
¶
Extract block with given header from markdown.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
markdown
|
str
|
The markdown to extract a section from |
required |
section_name
|
str
|
The header of the section to extract |
required |
Source code in src/jinjarope/mdfilters.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
|
md_escape
¶
Helper function to escape markup.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text
|
str
|
The text. |
required |
entity_type
|
str | None
|
For the entity types |
None
|
Source code in src/jinjarope/mdfilters.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
|
md_link
¶
Create a markdown link.
If link is empty string or None, just the text will get returned.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text
|
str | None
|
Text to show for the link |
None
|
link
|
str | None
|
Target url |
None
|
tooltip
|
str | None
|
Optional tooltip |
None
|
Source code in src/jinjarope/mdfilters.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
|
md_style
¶
md_style(
text: str,
*,
size: int | None = None,
bold: bool = False,
italic: bool = False,
code: bool = False,
align: Literal["left", "right", "center"] | None = None
) -> str
Apply styling to given markdown.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text
|
str
|
Text to style |
required |
size
|
int | None
|
Optional text size |
None
|
bold
|
bool
|
Whether styled text should be bold |
False
|
italic
|
bool
|
Whether styled text should be italic |
False
|
code
|
bool
|
Whether styled text should styled as (inline) code |
False
|
align
|
Literal['left', 'right', 'center'] | None
|
Optional text alignment |
None
|
Source code in src/jinjarope/mdfilters.py
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 |
|
shift_header_levels
¶
Shift the level of all headers of given text.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text
|
str
|
The Text to shift the header levels from |
required |
level_shift
|
int
|
Level delta. (1 means "increase level by 1") |
required |
Source code in src/jinjarope/mdfilters.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
|