SPB Git

Repository Public

README.md 2.8 KB

# Reference material (read-only copies)

Copies of the web application's sources that the native core must stay compatible with (backend note-spboucher-ai, commit 2c18f85): text.ts (plain text, word count, Markdown export, block ids), markdown.ts (Markdown import), html.ts (HTML export), validate.ts (server-side document checks), same-json.ts (key-order independent equality), service.ts (page versions and conflicts), web-editor-schema.txt (the ProseMirror schema of the web editor: node content expressions, attributes and defaults, marks).

Validate documents against the real web schema (the dev worktree on the backend node, never production):

scp docs.json M4M64c:/tmp/spn-docs.json
ssh M4M64c 'bash -lc "cd ~/dev/note-v2 && node_modules/.bin/tsx .spn-schema.mts validate /tmp/spn-docs.json"'

docs.json is one document or an array of documents; one line per document (ok … identical, ok … NORMALISED, FAIL …).

# 3.0 nodes (next/)

next/next-nodes.ts, next/next-nodes-html.ts and next/text.ts are the server sources Sources/SPNotesDocument/NextNodes.swift is a line-by-line port of (text, Markdown and HTML of mermaid, drawing, chart, queryView, citation, bibliography, pdf, blockRef, runCode, audio, canvasLink; attachment / page / reference ids; block id types). They were read on 2026-11-19 from the backend worktree M4M64c:~/dev/note-next while it was still uncommitted (HEAD 77ef5f0 + working tree; shasum prefixes 61d2222b6414 next-nodes.ts, a5c63324fb22 next-nodes-html.ts, 5aa71acc2fdf text.ts, re-copied at 13:30 after the backend made block ids stable across saves — exports unchanged). If the backend changes them before its release, re-copy, re-record and adapt the port.

Tests/SPNotesDocumentTests/Fixtures/next-server.json holds 521 documents with what the server's own functions return for them (toMarkdown, docText, wordCount, docToHtml(...).html, extractPageRefs); NextNodeExportTests.parityWithTheServerRecording requires Core to produce the same bytes. To re-record (read-only on the node: the script imports the worktree's modules and writes to /tmp):

SPN_DUMP_NEXT=/tmp/spn-next-docs.json SPN_ONLY=Document swift test --scratch-path .build-document --filter dumpDocumentsForTheServerRecording
scp /tmp/spn-next-docs.json docs/reference/next/record.mts M4M64c:/tmp/
ssh M4M64c 'bash -lc "cd ~/dev/note-next && node_modules/.bin/tsx /tmp/record.mts /tmp/spn-next-docs.json /tmp/spn-next-server.json"'
scp M4M64c:/tmp/spn-next-server.json Tests/SPNotesDocumentTests/Fixtures/next-server.json

web-editor-schema.txt is still the 2.x schema: the web editor's Tiptap extensions for the 3.0 nodes did not exist when Core 2.0 was written. Schema.nodeDefaults for those nodes comes from the table of SPEC §2; re-record the file when the web editor has them.

Files main
Menu

Theme