-
Notifications
You must be signed in to change notification settings - Fork 39
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
Button to copy as [cleaned] HTML #79
Comments
Hmmm, I think I’m a little on the fence about that. With the conversion to Markdown, things are comparably straightforward. Lots of stuff in Google Docs just can’t be represented in Markdown and it gets thrown out; stuff is pretty stripped down. On the other hand, HTML output can be as stripped down or detailed as you want, and there are lots of ways to do things, so it feels like this necessarily involves a lot of opinion about what kind of HTML you want, or what kinds of formatting you want to drop vs. keep, etc. It seems to me like this feature wind up being as big as the rest of the library. What exactly are you thinking here? Or is your intent to strip stuff down just as much as you would for Markdown, so this is effectively like converting to Markdown, then rendering as HTML (even if that’s not necessarily how it actually works)? |
Exactly. My idea was using Markdown as a relatively clean intermediary; probably something along the lines of taking the Markdown and handing it to Showdown. My use case would be
Totally understand. That's why I wanted to discuss rather than just PRing -- I totally get that it's very much a tack-on to your functionality and don't want to be presumptuous in proposing it on top of the meat of your work.
I honestly hadn't thought of that, but I would imagine that almost all generated Markdown would pass through an HTML renderer fine (although I admit it was only today I really looked at the code you wrote for Docs => Markdown conversion; great stuff in the face of spaghetti hah). I don't think that the HTML conversion would be mutating/dropping things all that much more. Thanks for your thoughts and time! |
Sorry I lost track of this issue. Thinking on it more, this might be useful, and I’d be OK if you want to work on adding it (assuming you’re still interested!).
I think this should use Remark/Rehype packages for this (example usage) since we are already in that ecosystem. (You can see where we set up a similar processing pipeline in
Yeah, it’s always valid Markdown output, which means it will definitely make valid HTML. I was more concerned that Docs → Markdown → HTML would strip out more than desired from the original doc, but it sounds like really stripping things down (not just simplifying the HTML code) is exactly what you want from from this, so it makes sense. (For example, if you have colored text in your doc, the Markdown conversion here will strip it out, which is intentional — 99% of the time, you don’t want that in a Markdown version of the doc.) |
I'd be interested in a feature to convert the cleaned markdown into clean HTML and then copy that (eliminating all the cruft of the Google Drive HTML export). Basically, alongside the Copy Markdown and Download Markdown (that I'm adding right now), there'd be a Copy HTML.
However, I know that that is adding essentially a new format to export in that's not Markdown.
I'm personally interested in this feature, but am more than happy to fork and add it there rather than PR this.
When I write this, @Mr0grog, are you interested in a PR? Or is that getting a bit too far from your vision?
The text was updated successfully, but these errors were encountered: