From f137ff9562468db0b2aed4366622e99a73b497ba Mon Sep 17 00:00:00 2001 From: Gamosoft Date: Mon, 13 Apr 2026 17:12:04 +0200 Subject: [PATCH] continuation for ordered lists --- documentation/FEATURES.md | 2 +- frontend/app.js | 2 +- frontend/editor-markdown-continue.js | 13 ++++++++++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/documentation/FEATURES.md b/documentation/FEATURES.md index aa194aa..78a69b8 100644 --- a/documentation/FEATURES.md +++ b/documentation/FEATURES.md @@ -33,7 +33,7 @@ - **Visual tree view** - Expandable/collapsible navigation - **Hide system folders** - Toggle to hide `_attachments`, `_templates` and other underscore-prefixed folders from sidebar - **Tab inserts tab** - Toggle to make Tab key insert a tab character in the editor instead of changing focus -- **List & quote continuation (Enter)** - At the end of a line, Enter continues blockquotes (`>`), bullets (`-` / `*` / `+`), and task lists (`- [ ]` / `- [x]`); pressing Enter again on an empty continued line exits the list or quote. Disabled inside fenced code blocks and when using Shift+Enter (plain newline) +- **List & quote continuation (Enter)** - At the end of a line, Enter continues blockquotes (`>`), bullets (`-` / `*` / `+`), ordered lists (`1.` / `1)`), and task lists (`- [ ]` / `- [x]`); pressing Enter again on an empty continued line exits the list or quote. Disabled inside fenced code blocks and when using Shift+Enter (plain newline) ### Export & Print - **HTML Export** - Download notes as standalone HTML files with all styling, images, diagrams, and math embedded diff --git a/frontend/app.js b/frontend/app.js index 26ff8cc..b2b9624 100644 --- a/frontend/app.js +++ b/frontend/app.js @@ -859,7 +859,7 @@ function noteApp() { }, /** - * Enter: continue blockquote / bullet / task list; second Enter on empty item exits (see editor-markdown-continue.js). + * Enter: continue blockquote / bullet / ordered list / task list; second Enter on empty item exits (see editor-markdown-continue.js). */ handleEditorEnterKey(event) { if (typeof EditorMarkdownContinue === 'undefined') return; diff --git a/frontend/editor-markdown-continue.js b/frontend/editor-markdown-continue.js index eac57c5..48ed75b 100644 --- a/frontend/editor-markdown-continue.js +++ b/frontend/editor-markdown-continue.js @@ -1,5 +1,5 @@ /** - * Markdown editor helpers: Enter continues blockquotes, bullets, and task lists. + * Markdown editor helpers: Enter continues blockquotes, bullets, ordered lists, and task lists. * Plain functions only; no DOM. Used by app.js handleEditorEnterKey. */ (function (global) { @@ -70,6 +70,17 @@ return { continuePrefix: quoteFull + inner + marker, isEmpty }; } + const orderedMatch = rest.match(/^(\s*)(\d+)([.)])\s+(.*)$/); + if (orderedMatch) { + const inner = orderedMatch[1]; + const num = parseInt(orderedMatch[2], 10); + const sep = orderedMatch[3]; + const cont = orderedMatch[4]; + const marker = (num + 1) + sep + ' '; + const isEmpty = cont.trim() === ''; + return { continuePrefix: quoteFull + inner + marker, isEmpty }; + } + if (quoteFull) { const isEmpty = rest.trim() === ''; return { continuePrefix: quoteFull, isEmpty };