Add alphabetic ordered list support to markdown parser#11446
Conversation
Co-authored-by: tommoor <380914+tommoor@users.noreply.github.com>
|
|
Co-authored-by: tommoor <380914+tommoor@users.noreply.github.com>
Co-authored-by: tommoor <380914+tommoor@users.noreply.github.com>
Co-authored-by: tommoor <380914+tommoor@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR adds support for parsing alphabetic ordered lists (a., b., c., etc.) to the markdown editor. The implementation addresses a user-reported issue where pasting markdown containing alphabetic lists would render as plain paragraphs instead of formatted lists.
Changes:
- Added a new markdown-it plugin that preprocesses alphabetic list markers by converting them to numeric equivalents while preserving the original marker information
- Integrated the plugin into the OrderedList node to handle the
data-list-styleattribute during parsing - Added comprehensive unit tests for the plugin and integration tests for the full parse/serialize flow
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| shared/editor/rules/alphaLists.ts | New markdown-it plugin that preprocesses alphabetic markers (a-z, A-Z) to numeric equivalents, tracks marker information via line mapping, and post-processes tokens to apply data-list-style attributes |
| shared/editor/rules/alphaLists.test.ts | Unit tests covering lowercase/uppercase alpha lists, numeric list preservation, the issue example, and multiple separate lists |
| shared/editor/nodes/OrderedList.ts | Registers the alphaLists plugin via rulePlugins getter and updates parseMarkdown() to handle the data-list-style attribute with fallback to markup checking |
| server/editor/index.test.ts | Integration tests verifying full parse/serialize round-trip for lowercase and uppercase alpha lists, blank line handling, and numeric list preservation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This PR contains the following updates: | Package | Update | Change | |---|---|---| | [outline/outline](https://github.com/outline/outline) | minor | `1.4.0` → `1.5.0` | --- ### Release Notes <details> <summary>outline/outline (outline/outline)</summary> ### [`v1.5.0`](https://github.com/outline/outline/releases/tag/v1.5.0) [Compare Source](outline/outline@v1.4.0...v1.5.0) #### What's Changed ##### Improvements - Added sorting options to the search screen in [#​11242](outline/outline#11242) - Added `diff` language highlighting for code blocks in [#​11301](outline/outline#11301) - Allow `cmd+enter` to toggle all checkboxes in a selection in [#​11322](outline/outline#11322) - Added support for currency sorting in tables in [#​11332](outline/outline#11332) - Added a custom color picker for text highlights in [#​11337](outline/outline#11337) - Clicking on a group in the share dialog now shows it's members in [#​11338](outline/outline#11338) - Table headers are now sticky in [#​11353](outline/outline#11353) - Importing toggle blocks from Notion is now supported in [#​11371](outline/outline#11371) - All tables in settings now have right-click context menu support in [#​11378](outline/outline#11378) - Added a hide/show completed items control for checkbox lists in [#​11379](outline/outline#11379) - Markdown frontmatter is now converted to YAML code blocks on import in [#​11420](outline/outline#11420) - Added a "Rename" option to sidebar context menus in [#​11425](outline/outline#11425) - Added Alt-click to recursively expand or collapse sidebar documents and collections in [#​11432](outline/outline#11432) - Added a preference for desktop notification badge with off, count, and indicator options in [#​11436](outline/outline#11436) - Added alphabetic ordered list support to markdown import and paste in [#​11446](outline/outline#11446) - Allow creating a new document before or after another in the sidebar in [#​11453](outline/outline#11453) ##### Fixes - Preserved alignment and caption when replacing images in [#​11407](outline/outline#11407) - Improved popularity scoring job performance in [#​11293](outline/outline#11293) - Fixed downloading mermaid images from the lightbox in [#​11300](outline/outline#11300) - Further popularity scoring performance improvements in [#​11305](outline/outline#11305) - Fixed text truncation with emoji icons in sidebar in [#​11307](outline/outline#11307) - Separated user input errors from internal errors for Sentry reporting in [#​11308](outline/outline#11308) - Fixed editor focus loss on text link interaction in [#​11310](outline/outline#11310) - Removed unnecessary Markdown conversion when importing HTML in [#​11315](outline/outline#11315) - Fixed "New draft" from command menu leading to "Not found" in [#​11316](outline/outline#11316) - Improved slow query in `CleanupDeletedDocumentsTask` in [#​11317](outline/outline#11317) - Removed Babel from production dependencies in [#​11318](outline/outline#11318) - Minor React performance optimizations in [#​11319](outline/outline#11319) - Fixed share panel state for drafts in a shared parent in [#​11320](outline/outline#11320) - Fixed embed option showing for links that cannot be embedded in [#​11323](outline/outline#11323) - Fixed non-admins being unable to see public ACL attachments in [#​11326](outline/outline#11326) - Fixed suggestion menu inserting at incorrect position when choosing with mouse in [#​11327](outline/outline#11327) - Fixed passkey registration with non-standard HTTPS ports in [#​11329](outline/outline#11329) - Fixed collapsed toggles not expanding when they contain the highlighted search result in [#​11330](outline/outline#11330) - Fixed column and row selection not restoring after sort or align in [#​11333](outline/outline#11333) - Renamed `DATABASE_READ_ONLY_URL` environment variable in [#​11334](outline/outline#11334) - Fixed Safari print offset issue in [#​11339](outline/outline#11339) - Permanently deleted documents are now removed from the local store in [#​11344](outline/outline#11344) - Fixed overly broad catch-all on root share in [#​11346](outline/outline#11346) - Removed hanging toggle sidebar button with no functionality in [#​11350](outline/outline#11350) - Fixed tables with merged cells behaving incorrectly when sorting in [#​11351](outline/outline#11351) - Fixed prefetching document structure for starred documents in [#​11355](outline/outline#11355) - Refactored `activeDocumentId` handling in [#​11144](outline/outline#11144) - Fixed missing outline on focused editable elements in [#​11362](outline/outline#11362) - Fixed document creation routing to use the correct parameter name in [#​11369](outline/outline#11369) - Fixed test snapshot in [#​11391](outline/outline#11391) - Auto-compressed images by [@​github-actions](https://github.com/github-actions)\[bot] in [#​11394](outline/outline#11394) - Fixed test snapshot in [#​11395](outline/outline#11395) - Fixed Sentry error resulting from browser extensions using MobX in [#​11399](outline/outline#11399) - Fixed selection toolbar issues around link selection in [#​11408](outline/outline#11408) - Removed unnecessary loading of authentication rows in `userProvisioner` in [#​11413](outline/outline#11413) - Allowlisted more methods for CSRF skip in [#​11414](outline/outline#11414) - Added `application_name` to database logging in [#​11415](outline/outline#11415) - Fixed exporting a document with a table causing a crash in [#​11422](outline/outline#11422) - Fixed an issue in active context creation due to a fallback in [#​11426](outline/outline#11426) - Stopped using public ACL for avatars in [#​11427](outline/outline#11427) - Fixed potential task queue saturation in the Notion importer in [#​11428](outline/outline#11428) - Fixed edits containing only a mention below edit distance not triggering a notification in [#​11434](outline/outline#11434) - Fixed missing check for disabled group mentions in [#​11435](outline/outline#11435) - Fixed mispositioned toolbar on first document open in [#​11437](outline/outline#11437) - Fixed creating a new document from the sidebar not redirecting correctly to edit mode in [#​11442](outline/outline#11442) - Fixed collections with the same name overwriting each other in export in [#​11443](outline/outline#11443) - Fixed notification badge not appearing until the notification popover was opened in [#​11444](outline/outline#11444) - Translation locale files now load over `CDN_URL` for better performance in [#​11445](outline/outline#11445) - Fixed synthetic "latest" revision failing to load in [#​11451](outline/outline#11451) - Added missing tooltips in [#​11452](outline/outline#11452) - Cleaned up the collection create dialog in [#​11454](outline/outline#11454) - Fixed small race conditions in the diagrams.net integration in [#​11458](outline/outline#11458) **Full Changelog**: <outline/outline@v1.4.0...v1.5.0> </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4zLjYiLCJ1cGRhdGVkSW5WZXIiOiI0My4zLjYiLCJ0YXJnZXRCcmFuY2giOiJtYWluIiwibGFiZWxzIjpbImltYWdlIl19--> Reviewed-on: https://gitea.alexlebens.dev/alexlebens/infrastructure/pulls/4012 Co-authored-by: Renovate Bot <renovate-bot@alexlebens.net> Co-committed-by: Renovate Bot <renovate-bot@alexlebens.net>
This PR contains the following updates: | Package | Update | Change | |---|---|---| | [outlinewiki/outline](https://github.com/outline/outline) | minor | `1.4.0` → `1.5.0` | --- ### Release Notes <details> <summary>outline/outline (outlinewiki/outline)</summary> ### [`v1.5.0`](https://github.com/outline/outline/releases/tag/v1.5.0) [Compare Source](outline/outline@v1.4.0...v1.5.0) ##### What's Changed ##### Improvements - Added sorting options to the search screen in [#​11242](outline/outline#11242) - Added `diff` language highlighting for code blocks in [#​11301](outline/outline#11301) - Allow `cmd+enter` to toggle all checkboxes in a selection in [#​11322](outline/outline#11322) - Added support for currency sorting in tables in [#​11332](outline/outline#11332) - Added a custom color picker for text highlights in [#​11337](outline/outline#11337) - Clicking on a group in the share dialog now shows it's members in [#​11338](outline/outline#11338) - Table headers are now sticky in [#​11353](outline/outline#11353) - Importing toggle blocks from Notion is now supported in [#​11371](outline/outline#11371) - All tables in settings now have right-click context menu support in [#​11378](outline/outline#11378) - Added a hide/show completed items control for checkbox lists in [#​11379](outline/outline#11379) - Markdown frontmatter is now converted to YAML code blocks on import in [#​11420](outline/outline#11420) - Added a "Rename" option to sidebar context menus in [#​11425](outline/outline#11425) - Added Alt-click to recursively expand or collapse sidebar documents and collections in [#​11432](outline/outline#11432) - Added a preference for desktop notification badge with off, count, and indicator options in [#​11436](outline/outline#11436) - Added alphabetic ordered list support to markdown import and paste in [#​11446](outline/outline#11446) - Allow creating a new document before or after another in the sidebar in [#​11453](outline/outline#11453) ##### Fixes - Preserved alignment and caption when replacing images in [#​11407](outline/outline#11407) - Improved popularity scoring job performance in [#​11293](outline/outline#11293) - Fixed downloading mermaid images from the lightbox in [#​11300](outline/outline#11300) - Further popularity scoring performance improvements in [#​11305](outline/outline#11305) - Fixed text truncation with emoji icons in sidebar in [#​11307](outline/outline#11307) - Separated user input errors from internal errors for Sentry reporting in [#​11308](outline/outline#11308) - Fixed editor focus loss on text link interaction in [#​11310](outline/outline#11310) - Removed unnecessary Markdown conversion when importing HTML in [#​11315](outline/outline#11315) - Fixed "New draft" from command menu leading to "Not found" in [#​11316](outline/outline#11316) - Improved slow query in `CleanupDeletedDocumentsTask` in [#​11317](outline/outline#11317) - Removed Babel from production dependencies in [#​11318](outline/outline#11318) - Minor React performance optimizations in [#​11319](outline/outline#11319) - Fixed share panel state for drafts in a shared parent in [#​11320](outline/outline#11320) - Fixed embed option showing for links that cannot be embedded in [#​11323](outline/outline#11323) - Fixed non-admins being unable to see public ACL attachments in [#​11326](outline/outline#11326) - Fixed suggestion menu inserting at incorrect position when choosing with mouse in [#​11327](outline/outline#11327) - Fixed passkey registration with non-standard HTTPS ports in [#​11329](outline/outline#11329) - Fixed collapsed toggles not expanding when they contain the highlighted search result in [#​11330](outline/outline#11330) - Fixed column and row selection not restoring after sort or align in [#​11333](outline/outline#11333) - Renamed `DATABASE_READ_ONLY_URL` environment variable in [#​11334](outline/outline#11334) - Fixed Safari print offset issue in [#​11339](outline/outline#11339) - Permanently deleted documents are now removed from the local store in [#​11344](outline/outline#11344) - Fixed overly broad catch-all on root share in [#​11346](outline/outline#11346) - Removed hanging toggle sidebar button with no functionality in [#​11350](outline/outline#11350) - Fixed tables with merged cells behaving incorrectly when sorting in [#​11351](outline/outline#11351) - Fixed prefetching document structure for starred documents in [#​11355](outline/outline#11355) - Refactored `activeDocumentId` handling in [#​11144](outline/outline#11144) - Fixed missing outline on focused editable elements in [#​11362](outline/outline#11362) - Fixed document creation routing to use the correct parameter name in [#​11369](outline/outline#11369) - Fixed test snapshot in [#​11391](outline/outline#11391) - Auto-compressed images by [@​github-actions](https://github.com/github-actions)\[bot] in [#​11394](outline/outline#11394) - Fixed test snapshot in [#​11395](outline/outline#11395) - Fixed Sentry error resulting from browser extensions using MobX in [#​11399](outline/outline#11399) - Fixed selection toolbar issues around link selection in [#​11408](outline/outline#11408) - Removed unnecessary loading of authentication rows in `userProvisioner` in [#​11413](outline/outline#11413) - Allowlisted more methods for CSRF skip in [#​11414](outline/outline#11414) - Added `application_name` to database logging in [#​11415](outline/outline#11415) - Fixed exporting a document with a table causing a crash in [#​11422](outline/outline#11422) - Fixed an issue in active context creation due to a fallback in [#​11426](outline/outline#11426) - Stopped using public ACL for avatars in [#​11427](outline/outline#11427) - Fixed potential task queue saturation in the Notion importer in [#​11428](outline/outline#11428) - Fixed edits containing only a mention below edit distance not triggering a notification in [#​11434](outline/outline#11434) - Fixed missing check for disabled group mentions in [#​11435](outline/outline#11435) - Fixed mispositioned toolbar on first document open in [#​11437](outline/outline#11437) - Fixed creating a new document from the sidebar not redirecting correctly to edit mode in [#​11442](outline/outline#11442) - Fixed collections with the same name overwriting each other in export in [#​11443](outline/outline#11443) - Fixed notification badge not appearing until the notification popover was opened in [#​11444](outline/outline#11444) - Translation locale files now load over `CDN_URL` for better performance in [#​11445](outline/outline#11445) - Fixed synthetic "latest" revision failing to load in [#​11451](outline/outline#11451) - Added missing tooltips in [#​11452](outline/outline#11452) - Cleaned up the collection create dialog in [#​11454](outline/outline#11454) - Fixed small race conditions in the diagrams.net integration in [#​11458](outline/outline#11458) **Full Changelog**: <outline/outline@v1.4.0...v1.5.0> </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4zLjYiLCJ1cGRhdGVkSW5WZXIiOiI0My4zLjYiLCJ0YXJnZXRCcmFuY2giOiJtYWluIiwibGFiZWxzIjpbImltYWdlIl19--> Reviewed-on: https://gitea.alexlebens.dev/alexlebens/infrastructure/pulls/4013 Co-authored-by: Renovate Bot <renovate-bot@alexlebens.net> Co-committed-by: Renovate Bot <renovate-bot@alexlebens.net>
Markdown-it doesn't recognize alphabetic list markers (a., b., c.) by default, causing pasted markdown with alpha lists to render as plain paragraphs instead of formatted lists.
Changes
shared/editor/rules/alphaLists.ts- New markdown-it plugin that:data-list-styleattribute (lower-alpha/upper-alpha)shared/editor/nodes/OrderedList.ts- Register plugin viarulePluginsgetter and handledata-list-styleattribute inparseMarkdown()Tests - Unit tests for plugin and integration tests for full parse/serialize flow
Example
Pasting this markdown:
## Step Three a. Do this. b. Do that.Now correctly renders as an alphabetic ordered list with
listStyle: "lower-alpha"instead of plain paragraphs.Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.