Skip to content

Commit

Permalink
[markdown] Simplify plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
anjos committed Nov 22, 2024
1 parent 17b99bf commit 296d3a9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/pelican/plugins/icons/markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ def __init__(
md: typing.Union[markdown.core.Markdown, None],
basepath: pathlib.Path,
):
self.basepath = basepath
super().__init__(pattern, md)
self.basepath = basepath

def handleMatch( # type: ignore[override] # noqa: N802
self, m: re.Match[str], data: str
Expand Down Expand Up @@ -85,13 +85,13 @@ class IconExtension(markdown.extensions.Extension):
"""

def __init__(self, **kwargs):
self.config = {"basepath": [kwargs["basepath"], "Basepath to SVG static files"]}
self.basepath = kwargs.pop("basepath")
super().__init__(**kwargs)

def extendMarkdown(self, md: markdown.core.Markdown): # noqa: N802
pattern = r"{svg}`(.*)`" # like {svg}`circle-check`
md.inlinePatterns.register(
IconSVGInlineProcessor(pattern, md, self.config["basepath"][0]), "svg", 999
IconSVGInlineProcessor(pattern, md, self.basepath), "svg", 999
)

pattern = r"{icon}`(.*)`" # like {icon}`fa-regular fa-circle-check`
Expand Down

0 comments on commit 296d3a9

Please sign in to comment.