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

Support converting HTML exported from Google Docs #60

Open
Mr0grog opened this issue May 1, 2023 · 0 comments
Open

Support converting HTML exported from Google Docs #60

Mr0grog opened this issue May 1, 2023 · 0 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@Mr0grog
Copy link
Owner

Mr0grog commented May 1, 2023

This tool was designed around copying and pasting content from Google Docs, and works reasonably well for that use case. However, some folks have asked about using it with HTML exported from Google Docs (e.g. @kdiogenes discusses this in a PR: #40 (comment)). This doesn’t currently work, but it would be great if it did!

The core issue is that, in exports, all the styles are in a stylesheet instead of inline, so we fail to pick up on them. For example, bold is done with font-weight: 700 in CSS. In copy/pasted output, that CSS is on an element’s style attribute, so we don’t have to do anything special to know that the element should be bold. But in exports, the element has a class attribute that references rules from an inline stylesheet instead. We need a way to parse the stylesheet and resolve the actual CSS properties that are applied as a result.

Links also get wrapped with https://www.google.com/url?q=<url> in exports. I’m not sure what else might be special or different yet.

Fortunately, we already have fixtures for the exported HTML and expected Markdown output; the tests for them are just skipped for now. Implementing this can probably be done by turning on those tests and then making them pass:

createFixtureTest('headings-and-paragraphs', { type: 'copy' });
createFixtureTest('headings-and-paragraphs', { type: 'export', skip: true });
createFixtureTest('inline-formatting', { type: 'copy' });
createFixtureTest('inline-formatting', { type: 'export', skip: true });
createFixtureTest('lists', { type: 'copy' });
createFixtureTest('lists', { type: 'export', skip: true });
createFixtureTest('tables', { type: 'copy' });
createFixtureTest('tables', { type: 'export', skip: true });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant