-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Feature: Split markdown shortcuts, import and export #4550
Description
Current @lexical/markdown package supports shortcuts (auto-replace while typing), import and export relying on the same transformers configuration. It also uses RegExp parsing that does not have any external dependencies, which is great for bundle size. On the other hand it has few disadvantages:
- If app only uses shortcuts (no import/export), transformers would still require all import/export related properties
- Transformers API became quite bloated with more expansion requests (support matcher function for markdown transformers #4500)
- RegExp matching is nowhere near to be as good as proper tokenization (Bug:
@lexical/markdowntext-formatcombination #2632, Bug: OL nested list must use three spaces rather than two #2214)
Related issues/PRs: #4449, #4500, #4339, #4461, and more
I think we can split these into separate features (or even packages), where shortcuts will keep relying on lightweight RegExp matching and simplified transformers configuration; import/export will use 3rd party dependency for proper tokenization (these features are less common and also can be lazy-loaded for certain scenarios, keeping initial bundle small)
// cc @themagickoala @xinyuan0801 @hanford would appreciate if you guys have any suggestions/ideas (e.g., regarding 3rd party parser) given you've had PPs for Lexical MD