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

Copy HTML tables as Markdown #1187

Open
phaseOne opened this issue May 1, 2022 · 2 comments
Open

Copy HTML tables as Markdown #1187

phaseOne opened this issue May 1, 2022 · 2 comments

Comments

@phaseOne
Copy link

phaseOne commented May 1, 2022

I noticed that the Copy As Markdown extension does not convert HTML tables to Markdown. I see from the docs that PopClip has integrated the Turndown package for conversion. @pilotmoon, from their docs it appears the addition of this feature here could be trivial by adding the turndown-plugin-gfm plugin to where Turndown is initialized in the PopClip closed source code. Once this has been completed, I don't believe any modifications to the Copy As Markdown extension are required. I'd make a PR, but I think this feature can only be added within the closed source components. I suppose I could make a forked version of this extension, but this seems like it would only be useful in the short-term.

@pilotmoon
Copy link
Owner

pilotmoon commented May 2, 2022

Great suggestion.

I've had a go at implemeting this purely as an extension - see the referencing commit. Note it was developed against latest PopClip Build 3887 from https://pilotmoon.com/popclip/download.

Ideally, if I could get it to work I would integrate it into PopClip itself.

Unfortunately I can't get it to work. I think it may be because in PopClip we're using linkedom instead of JSDOM, so the document model is slightly different to what it is expecting. There's a rows property in the table node that it can't find. I've done as much as I can for now I think.

@pilotmoon pilotmoon changed the title Unable to copy HTML table as Markdown Copy HTML tables as Markdown May 2, 2022
@spiritualgeek
Copy link

@pilotmoon - This needs to be introduced into the Copy as Markdown extension. In its currently form, it is very limiting. I find myself flicking to VSCode and using Markdown Paste all the time. Could this please be considered?

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants