feat(surface-render): render single newlines as line breaks (breaks: true default) - #199
Merged
Conversation
…true default) Parachute renders markdown the way Obsidian/GitHub-comments do — a single internal \n renders as a visible line break, not collapsed to a space per strict CommonMark. Enter=paragraph / Shift+Enter=newline only feels right if the newline actually shows. Wires remark-breaks into MarkdownView's remark pipeline (before remarkWikilinks, so it only ever sees plain text and can't re-split the wikilink plugin's styled inert-unresolved span). New `breaks` prop on MarkdownView/NoteRenderer, default true, opt-out for strict-CommonMark consumers. remark-breaks joins remark-gfm as a required peer dependency. 0.2.0 -> 0.3.0 (behavior-change default = minor bump; 0.x caret semantics mean consumers pinned to ^0.2.0, e.g. notes-ui, do not auto-resolve — a deliberate per-consumer opt-in).
…der matters only for literal newline inside wikilink syntax)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Parachute renders markdown the way Obsidian/GitHub-comments do: a single
\ninside a paragraph now renders as a visible line break, not collapsed to a space (strict CommonMark soft-break behavior). Enter=paragraph / Shift+Enter=newline only feels right if the newline actually shows. Markdown files stay clean — no trailing-two-spaces hacks needed.remark-breaksintoMarkdownView's remark pipeline, positioned beforeremarkWikilinks— it only ever sees plain paragraph text this way, and can't re-split the wikilink plugin's styled inert-unresolved<span>text node (whichmdast-util-find-and-replace, the mechanism both plugins share, treats generically by node type).breaks?: booleanprop on<MarkdownView>, defaulttrue.<NoteRenderer>forwards it straight through to the markdown branch (added to itsPick<MarkdownViewProps, …>).remark-breaksjoinsremark-gfmas a required peer dependency (imported unconditionally, same idiom).remark-breaks/mdast-util-find-and-replaceonly rewritestextmdast nodes, and code/inlineCode are distinct node types. Verified with a dedicated test.notes-ui(pinned^0.2.0) does not auto-resolve to this — checked, it's not affected until it deliberately bumps.Where it landed
packages/surface-render/src/markdown/MarkdownView.tsx— thebreaksprop + remark pipeline wiringpackages/surface-render/src/note/NoteRenderer.tsx— threadsbreaksthroughpackages/surface-render/package.json— version bump +remark-breakspeer/dev deppackages/surface-render/CHANGELOG.md,README.md— docspackages/surface-render/src/__tests__/MarkdownView.test.tsx— 8 new testsTest plan
All gates run locally in
packages/surface-render, literal counts:bun run test— 69/69 passed (8 test files, including 8 newbreakstests: default<br>, paragraph-split preserved,breaks={false}strict-CommonMark collapse, trailing-two-spaces hard break, backslash hard break, fenced-code non-interference, inline-code non-interference, wikilink-adjacent text run)bun run typecheck— clean (tsc --noEmit && tsc -p tsconfig.test.json)bun run lint— clean (biome check ., 39 files)bun run build— clean (tsc, version.ts regenerated to 0.3.0)Not merged, not tagged/published — reviewer to dispatch next.
🤖 Generated with Claude Code