Skip to content

Conversation

Soxasora
Copy link
Member

@Soxasora Soxasora commented Sep 9, 2025

Description

Introduces Lexical as a Markdown, Rich and Hybrid Text editor and renderer

Screenshots

Preliminar comment UI with no distinctions between markdown and rich text
In no way the final design

image image

New things

  • KaTeX is used in place of MathJax to render equations and LaTeX.
  • Shiki is used in place of React Syntax Highlighter to highlight code blocks - it is undoubtedly faster and lighter than RSH, reaching 4kB of size in the bundle (this has to be re-verified later)
  • Uploads are now concurrently processed, also featuring a percentage, with placeholder per each upload - the user can continue to write while it uploads
  • MediaOrLink preserves scroll on load, supports captions and resize
  • Embeds refactor with a load timeout that spawns an error component (context)
  • HTML from a lexical JSON state is parsed server-side via Linkedom, a performance-focused DOM simulator

Additional Context

Lexical is also used as a renderer (stripped of any plugins) of its editorState in JSON.
There is also the curiously named RenderMan, its job is to parse and render the JSON produced by Lexical into React nodes.

Since Lexical renders client-side, the HTML produced by Lexical is used as a placeholder with 1:1 styling until Lexical takes over

Progress

  • editor renders
  • can create items
  • can edit items (and restore a lexical editorState)
  • can switch between markdown and rich text
  • can instantly produce and serve sanitized HTML in SSR
  • experimental Shiki-based plain text and live markdown mode
  • can serve all embeds we support
  • can upload files!
  • can auto link everything
  • can render in markdown, lexical, html, json2jsx. indecise much?
  • can mention people, not yet subs
  • forgot

TODO

  • a really huge cleanup
  • a proper markdown mode
  • mention subs
  • migrate legacy content gracefully

Nodes status

Markdown spec compliance
  • Headings: OK
  • Paragraphs: OK
  • Line breaks: not tested
  • Emphasis: OK
  • Blockquotes: IN PROGRESS
    • Nested Blockquotes: n/a
  • Lists: not tested
  • Code: n/a
  • HR: OK
  • Links: OK
  • Images: OK-ish
    • address: resizing is messy and unpredictable
  • Escapes: OK
  • HTML ??
SN custom nodes
  • User Mentions
  • Territory Mentions
  • Item Mentions
  • Media-or-Link
  • Embeds
  • Bots UI (functionality is external, dictated by markdown conversions, should avoid user mentions trigger)
Markdown-Lexical transformations
  • User Mentions
  • Territory Mentions
  • Item Mentions
  • Media-or-Link
  • Embeds
  • Bots

Checklist

Are your changes backward compatible? Please answer below:

For example, a change is not backward compatible if you removed a GraphQL field or dropped a database column.
tbd

On a scale of 1-10 how well and how have you QA'd this change and any features it might affect? Please answer below:
tbd

For frontend changes: Tested on mobile, light and dark mode? Please answer below:
tbd

Did you introduce any new environment variables? If so, call them out explicitly here:
tbd

Did you use AI for this? If so, how much did it assist you?
Ask: better lexical understanding, things that weren't clear in documentation or in code, best practices
Agent: autocompletion and refactors

… SN theme, formik bridge touchups, a better toolbar style
…gic, image markdown transformer, testing on more scenarios
…t, re-introduce usage of Lexical in read mode
@Soxasora Soxasora changed the title rich text editor and renderer Hybrid Text Editor Sep 20, 2025
Soxasora and others added 18 commits September 29, 2025 15:46
recognize links also in markdown mode (toolbar);
markdownmode hook + light refactor;
experimental custom shortcuts manager
-- mod+shift+m to switch between modes;
messy fix link editor not updating state on node selection changes
…ustom commands for markdown mode, toolbar tweaks, light restructuring
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature new product features that weren't there before multimedia ui/ux
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant