Unescape HTML entities in summary and content before markdown conversion
This commit is contained in:
parent
86cbad98b0
commit
9378dac0fa
1 changed files with 9 additions and 0 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import html
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
|
@ -68,6 +69,10 @@ def replace_tags_in_text_message(entry: Entry) -> str:
|
||||||
|
|
||||||
first_image: str = get_first_image(summary, content)
|
first_image: str = get_first_image(summary, content)
|
||||||
|
|
||||||
|
# Unescape HTML entities (e.g., <h1> becomes <h1>) before converting to markdown
|
||||||
|
summary = html.unescape(summary)
|
||||||
|
content = html.unescape(content)
|
||||||
|
|
||||||
summary = markdownify(
|
summary = markdownify(
|
||||||
html=summary,
|
html=summary,
|
||||||
strip=["img", "table", "td", "tr", "tbody", "thead"],
|
strip=["img", "table", "td", "tr", "tbody", "thead"],
|
||||||
|
|
@ -199,6 +204,10 @@ def replace_tags_in_embed(feed: Feed, entry: Entry) -> CustomEmbed:
|
||||||
|
|
||||||
first_image: str = get_first_image(summary, content)
|
first_image: str = get_first_image(summary, content)
|
||||||
|
|
||||||
|
# Unescape HTML entities (e.g., <h1> becomes <h1>) before converting to markdown
|
||||||
|
summary = html.unescape(summary)
|
||||||
|
content = html.unescape(content)
|
||||||
|
|
||||||
summary = markdownify(
|
summary = markdownify(
|
||||||
html=summary,
|
html=summary,
|
||||||
strip=["img", "table", "td", "tr", "tbody", "thead"],
|
strip=["img", "table", "td", "tr", "tbody", "thead"],
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue