diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2024-10-14 06:41:14 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2024-10-14 06:41:14 -0300 |
commit | 41f0d592571f7066e785f9a4598fa48e26f1c0a0 (patch) | |
tree | cbb0551d65bc375076f27e54e754c91bcfdf3644 /src | |
parent | e6a2920d186c10048fc2a835008d5626164c73de (diff) |
replacer: auto-colorize whole summary by default
Diffstat (limited to 'src')
-rw-r--r-- | src/util/replacer.js | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/util/replacer.js b/src/util/replacer.js index a11e9c8f..74e18873 100644 --- a/src/util/replacer.js +++ b/src/util/replacer.js @@ -614,10 +614,15 @@ export function postprocessSummaries(inputNodes) { textContent += node.data.slice(parseFrom, match.index); parseFrom = match.index + match[0].length; - // We're wrapping the contents of the <summary> with a <span>. - // This means we have to add the closing </span> where the summary ends. + const colorizeWholeSummary = !match[1].includes('<b>'); + + // We're wrapping the contents of the <summary> with a <span>, and + // possibly with a <b>, too. This means we have to add the closing tags + // where the summary ends. textContent += `<summary><span>`; + textContent += (colorizeWholeSummary ? `<b>` : ``); textContent += match[1]; + textContent += (colorizeWholeSummary ? `</b>` : ``); textContent += `</span></summary>`; } |