diff --git a/README.md b/README.md index b51f678..8d2386a 100644 --- a/README.md +++ b/README.md @@ -92,12 +92,12 @@ You're welcome to [make a feature request](https://github.com/Stardown-app/Stard ### Paste structured data * [obsidian-ReadItLater](https://github.com/DominikPieper/obsidian-ReadItLater) is an Obsidian plugin that creates notes with specific structures from clipboard content based on where it was copied from. -* [Advanced Paste](https://learn.microsoft.com/en-us/windows/powertoys/advanced-paste) is a Windows-only [PowerToys](https://learn.microsoft.com/en-us/windows/powertoys/install) feature made by Microsoft that converts clipboard content to other formats like markdown or JSON. +* [Advanced Paste](https://learn.microsoft.com/en-us/windows/powertoys/advanced-paste) is a Windows-only [PowerToys](https://learn.microsoft.com/en-us/windows/powertoys/install) feature made by Microsoft that converts clipboard content to other markup languages like markdown or JSON. -### Copy links in other formats besides markdown +### Copy web page links in other markup languages besides markdown * [url2clipboard](https://github.com/asamuzaK/url2clipboard) supports HTML, Markdown, BBCode, Textile, AsciiDoc, MediaWiki, Jira, reStructuredText, LaTeX, Org Mode, and text. -* [TabCopy](https://chromewebstore.google.com/detail/tabcopy/micdllihgoppmejpecmkilggmaagfdmb) might only be on the Chrome Web Store, but supports many formats including HTML, Markdown, BBCode, CSV, and JSON, and lets you create custom link formats. +* [TabCopy](https://chromewebstore.google.com/detail/tabcopy/micdllihgoppmejpecmkilggmaagfdmb) might only be on the Chrome Web Store, but supports many markup languages including HTML, Markdown, BBCode, CSV, and JSON, and lets you create custom link formats. ### Copy just the titles or just the URLs of all tabs diff --git a/src/converters/utils/html.js b/src/converters/utils/html.js index 19244ee..4fff991 100644 --- a/src/converters/utils/html.js +++ b/src/converters/utils/html.js @@ -24,11 +24,14 @@ export function removeHiddenElements(node, doc) { const SHOW_ELEMENT = 1; const iterator = doc.createNodeIterator(node, SHOW_ELEMENT); + const ELEMENT_NODE = 1; let currentNode = iterator.nextNode(); while (currentNode) { - const style = currentNode.style; - if (style.display === "none" || style.visibility === "hidden") { - currentNode.parentNode.removeChild(currentNode); + if (currentNode.nodeType === ELEMENT_NODE) { + const style = doc.defaultView.getComputedStyle(currentNode); + if (style.display === 'none' || style.visibility === 'hidden') { + currentNode.parentNode.removeChild(currentNode); + } } currentNode = iterator.nextNode();