From ac761413e7543766036f14be2cd2fcaa0c556e75 Mon Sep 17 00:00:00 2001 From: hole-thu Date: Tue, 23 Jun 2026 23:23:24 +0800 Subject: [PATCH] Fix hightlight rule --- src/Common.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/Common.js b/src/Common.js index 12848f9..7075e9e 100644 --- a/src/Common.js +++ b/src/Common.js @@ -15,6 +15,20 @@ import { cache } from './cache'; export { format_time, Time, TitleLine }; +const HIGHLIGHT_TEXT_PARENT_TAGS = new Set([ + 'p', + 'li', + 'blockquote', + 'td', + 'th', + 'h1', + 'h2', + 'h3', + 'h4', + 'h5', + 'h6', +]); + const pushServerPublicKey = 'BLM6zZy2CWlsfQ9KsALDgrjPXBf8E3cJ7qQ5vZipN_IjOfeDXFjeYb_zRLzwglyiwr9QpVL9Lt1TS_sZKewJYuY'; @@ -194,7 +208,9 @@ export class HighlightedMarkdown extends Component { { shouldProcessNode(node) { return ( - node.type === 'text' && node.parent && node.parent.name === 'p' + node.type === 'text' && + node.parent && + HIGHLIGHT_TEXT_PARENT_TAGS.has(node.parent.name) ); // pid, nickname, search }, processNode(node, children, index) {