Add emoji processing
This commit is contained in:
parent
294bd887ba
commit
e99b7584d2
|
@ -10,6 +10,7 @@ from urllib.parse import unquote
|
|||
|
||||
import html_sanitizer.sanitizer as sanitizer
|
||||
import lxml.html # nosec
|
||||
import emoji
|
||||
import mistune
|
||||
import nio
|
||||
from html_sanitizer.sanitizer import Sanitizer
|
||||
|
@ -215,6 +216,12 @@ class HTMLProcessor:
|
|||
if not outgoing:
|
||||
self._matrix_to_links_add_classes(a_tag)
|
||||
|
||||
for node in tree.iterdescendants():
|
||||
if node.tag != "code" and node.text:
|
||||
node.text = emoji.emojize(node.text, language="alias")
|
||||
if node.getparent() and node.getparent().tag != "code" and node.tail:
|
||||
node.tail = emoji.emojize(node.tail, language="alias")
|
||||
|
||||
html = etree.tostring(tree, encoding="utf-8", method="html").decode()
|
||||
html = sanit.sanitize(html).rstrip("\n")
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user