A CLI tool (in examples/
or maybe available in npx?) which takes up an editorState JSON from stdin and renders read-only HTML to stdout
#7177
Replies: 2 comments 3 replies
-
This isn’t possible to implement as a general CLI tool because your editor can define nodes and override behavior. The JSON doesn’t make sense without your editor’s code and configuration. You need to write your own CLI tool that is specific to your editor’s JSON. |
Beta Was this translation helpful? Give feedback.
-
I put in my current solution in https://github.com/vadimkantorov/lexical-cli-render Looking for help on how to add
Looking forward for any help :) Thank you! UPD: currently figured out how to import EmojiNode and run with Remaining questions:
@etrepum maybe my repo can be converted to |
Beta Was this translation helpful? Give feedback.
-
Then this tool could be used using process invocation from non-JS static site generators (e.g. I would use Lexical for my blog post editor and commit
.lexical
JSON files to the backing GitHub repo, and then in GitHub Actions would use some SSG tool to generate HTML from them).I guess one could use
createHeadlessEditor
from https://lexical.dev/docs/packages/lexical-headless and then$generateHtmlFromNodes
from https://lexical.dev/docs/packages/lexical-html, but it would be nice to have them combined in a ready-to-use CLI tool. It would also allow for the produced HTML to be in better match with what's used during editing.Ideally, it should be possible to have the tool runnable as
cat myEditorState.lexical | node lexical-render.js > my.html
Here is what ChatGPT suggests, need to try/fix it (
npm install lexical-headless @lexical/html lexical; cat editorState.lexical | node lexical-to-html.js
:Beta Was this translation helpful? Give feedback.
All reactions