Skip to content

How to implement custom plugin #396

Answered by Paillat-dev
Paillat-dev asked this question in Q&A
Discussion options

You must be logged in to vote
import mistune
from mistune.plugins.formatting import strikethrough
from mistune.util import escape, safe_entity
from typing_extensions import override

if TYPE_CHECKING:
    from mistune.core import BaseRenderer, InlineState
    from mistune.inline_parser import InlineParser
    from mistune.markdown import Markdown

from typing import Any

from mistune.helpers import PREVENT_BACKSLASH
from mistune.plugins.formatting import _parse_to_end  # pyright: ignore[reportPrivateUsage,reportUnknownVariableType]

_SPOILER_END = re.compile(r"(?:" + PREVENT_BACKSLASH + r"\\\||[^\s\|])\|\|(?!\|)")


def parse_spoiler(inline: "InlineParser", m: Match[str], state: "InlineState") -> int | None:
    return 

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@Paillat-dev
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by Paillat-dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants