Classes
Marked
10
▼
A string subclass marking content as already safe for markdown output.
The Marked class implements…
Marked
10
▼
A string subclass marking content as already safe for markdown output.
The Marked class implements the__markdown__protocol used by the
template engine to identify pre-escaped markdown content. When combined
with regular strings via operators like+, the non-Marked strings are
automatically escaped.
This is the markdown-mode analogue ofMarkup for HTML and Styled
for terminal mode.
Methods
format
2
Self
▼
format
2
Self
▼
def format(self, *args: Any, **kwargs: Any) -> Self
Parameters
| Name | Type | Description |
|---|---|---|
*args |
— |
|
**kwargs |
— |
Returns
Self
join
1
Self
▼
join
1
Self
▼
def join(self, seq: Iterable[str]) -> Self
Parameters
| Name | Type | Description |
|---|---|---|
seq |
— |
Returns
Self
Internal Methods 8 ▼
__new__
1
Self
▼
__new__
1
Self
▼
def __new__(cls, value: Any = '') -> Self
Parameters
| Name | Type | Description |
|---|---|---|
value |
— |
Default:''
|
Returns
Self
__markdown__
0
Self
▼
Return self -- already safe content.
__markdown__
0
Self
▼
def __markdown__(self) -> Self
Returns
Self
__repr__
0
str
▼
__repr__
0
str
▼
def __repr__(self) -> str
Returns
str
__add__
1
Self
▼
__add__
1
Self
▼
def __add__(self, other: str) -> Self
Parameters
| Name | Type | Description |
|---|---|---|
other |
— |
Returns
Self
__radd__
1
Self
▼
__radd__
1
Self
▼
def __radd__(self, other: str) -> Self
Parameters
| Name | Type | Description |
|---|---|---|
other |
— |
Returns
Self
__mul__
1
Self
▼
__mul__
1
Self
▼
def __mul__(self, n: SupportsIndex) -> Self
Parameters
| Name | Type | Description |
|---|---|---|
n |
— |
Returns
Self
__mod__
1
Self
▼
__mod__
1
Self
▼
def __mod__(self, args: Any) -> Self
Parameters
| Name | Type | Description |
|---|---|---|
args |
— |
Returns
Self
__format__
1
Self
▼
__format__
1
Self
▼
def __format__(self, format_spec: str) -> Self
Parameters
| Name | Type | Description |
|---|---|---|
format_spec |
— |
Returns
Self
Functions
markdown_escape
1
str
▼
Escape GFM special characters in untrusted input.
Checks the ``__markdown__`` …
markdown_escape
1
str
▼
def markdown_escape(value: Any) -> str
Escape GFM special characters in untrusted input.
Checks the__markdown__protocol first — objects that implement it
are considered pre-escaped and returned as-is (like__html__for
Markup or__terminal__for Styled).
Parameters
| Name | Type | Description |
|---|---|---|
value |
Any |
Value to escape (will be converted to string). |
Returns
str