We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
NestedTokens.closing
1 parent 2afb7cc commit 031b329Copy full SHA for 031b329
markdown_it/token.py
@@ -117,7 +117,7 @@ class NestedTokens:
117
"""
118
119
opening: Token = attr.ib()
120
- closing: Optional[Token] = attr.ib()
+ closing: Token = attr.ib()
121
children: List[Union[Token, "NestedTokens"]] = attr.ib(factory=list)
122
123
def __getattr__(self, name):
@@ -144,6 +144,9 @@ def nest_tokens(tokens: List[Token]) -> List[Union[Token, NestedTokens]]:
144
token = token.copy()
145
output.append(token)
146
if token.children:
147
+ # Ignore type checkers because `nest_tokens` doesn't respect
148
+ # typing of `Token.children`. We add `NestedTokens` into a
149
+ # `List[Token]` here.
150
token.children = nest_tokens(token.children) # type: ignore
151
continue
152
0 commit comments