Skip to content

Commit a728952

Browse files
committed
fix(plugin): fix footnote plugins when rendering ast
1 parent 9058e0d commit a728952

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/mistune/markdown.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def __init__(
4040
self.before_parse_hooks: List[Callable[["Markdown", BlockState], None]] = []
4141
self.before_render_hooks: List[Callable[["Markdown", BlockState], Any]] = []
4242
self.after_render_hooks: List[
43-
Callable[["Markdown", Union[str, List[Dict[str, Any]]], BlockState], str]
43+
Callable[["Markdown", Union[str, List[Dict[str, Any]]], BlockState], Union[str, List[Dict[str, Any]]]]
4444
] = []
4545

4646
if plugins:

src/mistune/plugins/footnotes.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,7 @@ def parse_footnote_item(
9494

9595
def md_footnotes_hook(
9696
md: "Markdown", result: Union[str, List[Dict[str, Any]]], state: BlockState
97-
) -> str:
98-
assert isinstance(result, str)
97+
) -> Union[str, List[Dict[str, Any]]]:
9998
notes = state.env.get("footnotes")
10099
if not notes:
101100
return result
@@ -107,8 +106,7 @@ def md_footnotes_hook(
107106
state = BlockState()
108107
state.tokens = [{'type': 'footnotes', 'children': children}]
109108
output = md.render_state(state)
110-
assert isinstance(output, str)
111-
return result + output
109+
return result + output # type: ignore[operator]
112110

113111

114112
def render_footnote_ref(renderer: "BaseRenderer", key: str, index: int) -> str:

0 commit comments

Comments
 (0)