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
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
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
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
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
shift_header_levels
¶
shift_header_levels(text: str, level_shift: int) -> str
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 |