MCPcopy Create free account
hub / github.com/executablebooks/markdown-it-py / convert_attrs

Function convert_attrs

markdown_it/token.py:9–18  ·  view source on GitHub ↗

Convert Token.attrs set as ``None`` or ``[[key, value], ...]`` to a dict. This improves compatibility with upstream markdown-it.

(value: Any)

Source from the content-addressed store, hash-verified

7
8
9def convert_attrs(value: Any) -> Any:
10 """Convert Token.attrs set as ``None`` or ``[[key, value], ...]`` to a dict.
11
12 This improves compatibility with upstream markdown-it.
13 """
14 if not value:
15 return {}
16 if isinstance(value, list):
17 return dict(value)
18 return value
19
20
21@dc.dataclass(slots=True)

Callers 1

__post_init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…