Skip to content

feat(markdown): node content is the markdown source of its body - #158

Merged
mindsocket merged 7 commits into
mainfrom
issue-147
Oct 16, 2026
Merged

mindsocket merged 7 commits into
mainfrom
issue-147

Conversation

@mindsocket

@mindsocket mindsocket commented Oct 16, 2026 •

Copy link
Copy Markdown
Owner

Closes #147. Bottom of a stack: #158 → #159 → #160 → #161.

Summary

  • A node's content is now the markdown source of its body, sliced from the original text. It is no longer rebuilt from parsed blocks, so loose lists stay loose, separate lists stay separate, and line endings are kept.
  • Embedded nodes own the text under their heading or list item, minus nested embedded nodes. A heading at the same or a higher level ends the section; a deeper untyped heading stays inside it.
  • Lines holding only inline fields (key:: value, [key:: value]) are left out of content, like YAML field blocks. A field written mid-sentence stays in the prose.
  • A list-item node's content is dedented by the item's content indent.
  • Headings deeper than H5 were dropped from content; they are now kept.
  • okf-computation-present now requires a # Computation section. Known limitation, documented in the rule: it also matches that line inside a fenced code block.
  • Content before the first heading of a space on a page stays discarded; now documented.

Notes for review

  • content changes for every space. Smoke tests against local spaces pass.
  • hypothesis: Miro cards (src/plugins/miro/styles.ts) now show raw markdown. Cheapest check: render a card from a node whose content contains **bold**.
  • hypothesis: tab-indented list-item content may be over-dedented, since a tab counts as one column. Cheapest check: one test with tab indentation.

content is now sliced verbatim from the original markdown instead of being
rebuilt from mdast plain text, for page nodes and embedded heading, list item
and table-fallback content. Inline formatting, links, code fences and lists
survive. Embedded nodes exclude nested embedded nodes. Untyped headings are
kept in the content of the enclosing node and now end a deeper embedded
node's section, so a '# Computation' section is visible in the page content.

measured: existing tests asserted only plain single-paragraph bodies, so none
changed; the new tests in parse-embedded-content.test.ts cover the markdown,
heading and nesting cases.

Space-on-a-page preamble is still discarded (no node owns it).
The rule accepted any body text because node content was plain text without
headings. Content is now markdown source, so the rule checks for a
'# Computation' heading line (or a computation path).

measured: body-without-computation.md (prose body, no such heading) is flagged;
the bundle's computations/revenue.md still passes.
Content is now taken from the original text as source ranges per node
instead of being rebuilt from per-block slices, so blank lines, list
looseness and line endings survive. Inline field lines are stripped like
YAML blocks; fields mid-sentence stay in prose. Untyped headings end the
section of embedded nodes at the same or a higher level and stay inside
deeper ones. Missing source positions now throw.
Pin the known false pass on a '# Computation' line inside a code fence
with a fixture, and state it in the rule description.
…dent

Continuation content of a list item node now reads as markdown on its own.
Lines indented further keep their extra indent; line endings are preserved.
Heading and page content is unchanged.
@mindsocket
mindsocket added this pull request to stack #162 October 16, 2026 01:21
@mindsocket mindsocket changed the title issue 147 feat(markdown): node content is the markdown source of its body Oct 16, 2026
Comment thread docs/schemas.md Resolved
@mindsocket
mindsocket removed this pull request from stack #162 October 16, 2026 03:55
@mindsocket
mindsocket added this pull request to stack #167 October 16, 2026 03:55
@mindsocket
mindsocket marked this pull request as ready for review October 16, 2026 03:56
@claude

claude Bot commented Oct 16, 2026

Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

🤖 Generated with Claude Code

@mindsocket
mindsocket merged commit 89f7d80 into main Oct 16, 2026
4 checks passed
@mindsocket
mindsocket deleted the issue-147 branch October 16, 2026 06:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Keep node body content as markdown

1 participant