Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compute style when removing hidden nodes #122

Merged
merged 2 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
9 changes: 6 additions & 3 deletions src/converters/utils/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down