Added _mfm_blur_ class check

This commit is contained in:
Casey 2023-05-08 18:28:43 +03:00
parent 3bd0b78122
commit 7955120a7c
Signed by: hkc
GPG Key ID: F0F6CFE11CDB0960
1 changed files with 12 additions and 0 deletions

View File

@ -86,6 +86,14 @@ def node_to_html(el: PageElement) -> str:
"code": lambda tag: ( "code": lambda tag: (
"<code>%s</code>" % str.join("", map(node_to_html, tag.children)) "<code>%s</code>" % str.join("", map(node_to_html, tag.children))
), ),
"span": lambda tag: (
(
'<span class="tg-spoiler">%s</span>'
if "_mfm_blur_" in tag["class"]
else "%s"
)
% str.join("", map(node_to_html, tag.children))
),
"blockquote": lambda tag: "\n%s" "blockquote": lambda tag: "\n%s"
% str.join( % str.join(
"\n", "\n",
@ -177,6 +185,10 @@ def node_to_markdown(el: PageElement) -> str:
"code": lambda tag: ( "code": lambda tag: (
"`%s`" % str.join("", map(node_to_markdown, tag.children)) "`%s`" % str.join("", map(node_to_markdown, tag.children))
), ),
"span": lambda tag: (
("||%s||" if "_mfm_blur_" in tag["class"] else "%s")
% str.join("", map(node_to_markdown, tag.children))
),
"blockquote": lambda tag: ( "blockquote": lambda tag: (
"\n%s" "\n%s"
% str.join( % str.join(