Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisjsewell committed Jun 5, 2023
1 parent 2dd286c commit f0643a2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion markdown_it/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def add_render_rule(
it should have the signature ``function(renderer, tokens, idx, options, env)``
"""
if self.renderer.__output__ == fmt:
self.renderer.rules[name] = function.__get__(self.renderer) # type: ignore
self.renderer.rules[name] = function.__get__(self.renderer)

def use(
self, plugin: Callable[..., None], *params: Any, **options: Any
Expand Down
6 changes: 5 additions & 1 deletion markdown_it/renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Renderer

from collections.abc import Sequence
import inspect
from typing import Any, ClassVar, Protocol
from typing import Any, Callable, ClassVar, MutableMapping, Protocol

from .common.utils import escapeHtml, unescapeAll
from .token import Token
Expand All @@ -18,6 +18,10 @@ class Renderer

class RendererProtocol(Protocol):
__output__: ClassVar[str]
rules: MutableMapping[
str,
Callable[[Sequence[Token], int, OptionsDict, EnvType], str],
]

def render(
self, tokens: Sequence[Token], options: OptionsDict, env: EnvType
Expand Down

0 comments on commit f0643a2

Please sign in to comment.