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

Add HTML export/import documentation to website #2249

Merged
merged 2 commits into from
May 24, 2022

Conversation

tylerjbainbridge
Copy link
Contributor

@tylerjbainbridge tylerjbainbridge commented May 23, 2022

Documentation for the Lexical -> HTML and HTML -> Lexical introduced in #2246.

@vercel
Copy link

vercel bot commented May 23, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
lexical ✅ Ready (Inspect) Visit Preview May 24, 2022 at 9:18PM (UTC)
lexical-playground ✅ Ready (Inspect) Visit Preview May 24, 2022 at 9:18PM (UTC)

### Lexical -> HTML
When generating HTML from an editor you can pass in a selection object to narrow it down to a certain section or pass in null to convert the whole editor.
```js
const htmlString = $generateHtmlFromNodes(editor, selection | null);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: should it be all capital for HTML (to match importDOM, exportDOM, etc)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hard to know...is there an official rule for naming camelcase variables with acronyms?

On one hand it reads fine when the function ends with all capitals, but if it's in the middle it becomes a bit harder to read. Happy to rename here and in the code itself if we want to be consistent with DOM and HTML.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's address this in a follow up if needed.

@harish-sethuraman
Copy link
Contributor

Hey! I was trying to use the library @lexical/html? as mentioned in the code and seems like the library is not yet published in the npm registry? Or am I doing anything wrong?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants