diff --git a/Shared/Article Rendering/main.js b/Shared/Article Rendering/main.js index 927d7f6a4..1ff819fc8 100644 --- a/Shared/Article Rendering/main.js +++ b/Shared/Article Rendering/main.js @@ -154,6 +154,13 @@ function styleLocalFootnotes() { } } +// convert 📰 to a text node containing 📰 +function removeWpSmiley() { + for (const img of document.querySelectorAll("img.wp-smiley[alt]")) { + img.parentNode.replaceChild(document.createTextNode(img.alt), img); + } +} + function processPage() { wrapFrames(); wrapTables(); @@ -163,5 +170,6 @@ function processPage() { convertImgSrc(); flattenPreElements(); styleLocalFootnotes(); + removeWpSmiley() postRenderProcessing(); } diff --git a/Shared/Article Rendering/shared.css b/Shared/Article Rendering/shared.css index fa2a5920d..fc2892d2a 100644 --- a/Shared/Article Rendering/shared.css +++ b/Shared/Article Rendering/shared.css @@ -257,6 +257,7 @@ blockquote { border-top: 1px solid var(--header-table-border-color); } +/* see removeWpSmiley; this rule is kept in case a wp-smiley is encountered without alt text */ .wp-smiley { height: 1em; max-height: 1em;