feat(workspace): numbered lists and reliable markdown paste
MindSift CI & Docker Release / Build, Test in Container & Push (push) Successful in 2m5s
MindSift CI & Docker Release / Build, Test in Container & Push (push) Successful in 2m5s
- block type 'numbered' (/number): 1., a., i. by nesting, continues on Enter, an empty item ends the list; markdown export/import as 1. - pasting: parser moved to lib/pasteOutline with tests; blank lines split paragraphs, numbered lists keep their type, indentation levels follow the widths in use (2, 3 or 4 spaces, tabs) - text that stays in the focused block after pasting (a paragraph with line breaks) was dropped; the block now takes it Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9008d7c915
commit
2bfe74e66b
13 files changed
+286
-176
No files matched your search
@@ -441,6 +441,8 @@ func CompileBlocksToMarkdown(blocks []DocumentBlock) string {
|
||||
sb.WriteString(indent + "- ```" + b.Lang + "\n" + b.Content + "\n" + indent + " ```\n")
|
||||
case "divider":
|
||||
sb.WriteString(indent + "- ---\n")
|
||||
case "numbered":
|
||||
sb.WriteString(indent + "1. " + b.Content + "\n")
|
||||
default:
|
||||
sb.WriteString(indent + "- " + b.Content + "\n")
|
||||
}
|
||||
|
||||
@@ -258,6 +258,9 @@ func blocksToVaultMarkdown(blocks []domain.DocumentBlock, attachment func(id str
|
||||
sb.WriteString(indent + "- ---\n")
|
||||
case "callout":
|
||||
sb.WriteString(indent + "- > " + cont(content, " > ") + "\n")
|
||||
case "numbered":
|
||||
// Markdown renumbers the items itself
|
||||
sb.WriteString(indent + "1. " + cont(content, " ") + "\n")
|
||||
default:
|
||||
if strings.TrimSpace(content) == "" {
|
||||
sb.WriteString(indent + "-\n")
|
||||
|
||||
@@ -824,6 +824,9 @@ func MarkdownToBlocks(md string) []domain.DocumentBlock {
|
||||
level := listLevel(indentWidth(m[1]))
|
||||
content := m[2]
|
||||
typ := "bullet"
|
||||
if t := strings.TrimLeft(line, " \t"); t != "" && t[0] >= '0' && t[0] <= '9' {
|
||||
typ = "numbered"
|
||||
}
|
||||
checked := false
|
||||
if c := checkboxRe.FindStringSubmatch(content); c != nil {
|
||||
typ, checked, content = "todo", c[1] != " ", c[2]
|
||||
|
||||
Reference in new issue
Block a user