Skip to content

feat(app): add a setting to join single line breaks - #798

Closed
leemour wants to merge 1 commit into
markrahq:mainfrom
leemour:feat/join-soft-line-breaks
Closed

leemour wants to merge 1 commit into
markrahq:mainfrom
leemour:feat/join-soft-line-breaks

Conversation

@leemour

@leemour leemour commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds an opt-in setting that joins single line breaks inside a paragraph, the way GitHub and other CommonMark renderers do.

Since #451 (for #449), the visual editor shows every single line break from the source as a real line break. That's right for files written line by line, but files that wrap long lines by hand turn into ragged short lines. For example, a list item wrapped at 120 columns:

- `pnpm test` runs vitest. `@wirecat/cli-base/testing/setup` gives each test file its own temporary home folder, a
  keyring that throws and no network, and points this CLI's config, state, cache and the shared store into that
  folder.

The new switch is Settings → Extended syntax → Join single line breaks. It's off by default, so nothing changes for current users.

Off (default, unchanged) On
before after

Changes

  • packages/app/src/components/markdown-paper-plugins.ts: markraCommonmark takes { joinSoftLineBreaks } and passes it to the hardbreak schema. When it's on, a soft break (isInline without renderLineBreak) renders as a span with a space, like Milkdown's default. The span has no markra-hardbreak class, so parseDOM won't read it back as a rendered <br>. Shift+Enter breaks, callout lines and hard breaks (backslash or two trailing spaces) still render as <br>.
  • packages/app/src/components/MarkdownPaperSurface.tsx: reads the flag from extendedSyntax and recreates the editor when it changes, the same way githubAlerts works.
  • packages/app/src/components/MarkdownExportDocument.tsx: HTML/PDF export skips remark-breaks when the setting is on, so export matches the editor.
  • packages/app/src/lib/settings/app-settings.ts, EditorSettings.tsx: the new extendedSyntax.joinSoftLineBreaks preference (default false) and its switch.
  • packages/shared/src/i18n/locales/*: labels in all 11 locales.
  • Tests: the editor with the setting on and off (list item soft wrap, hard break, callout), export, and preference normalization. Existing test fixtures get the new field.

Only the display changes. The serializer is untouched, and a test checks that both modes save the same Markdown.

Behavior

Off (default) On
Single line break in a paragraph or list item Line break (unchanged) Space, lines join
Shift+Enter, \ or two-space hard break Line break Line break
Callout body lines Line break Line break
HTML/PDF export remark-breaks (unchanged) No remark-breaks

Desktop and web behave the same.

Verification

  • pnpm --filter @markra/shared test passed, 52 tests
  • pnpm --filter @markra/app typecheck:test passed
  • pnpm --filter @markra/app build passed
  • pnpm --filter @markra/app test: 1855 passed, 1 failed. The failing test is App.test.tsx > opens a document tab to a side editor, toggles both panes to source mode, and closes the side tab from the titlebar, which times out at 5000 ms. It fails the same way on main without this change.
  • Screenshots come from the web app (apps/web, Vite) in Chrome. I couldn't run Playwright's WebKit on Ubuntu 26.04.

Risks

If you'd rather name or place the switch differently, I'm happy to change it.

I worked on this together with Claude Code.

🤖 Generated with Claude Code

Markra shows every single line break inside a paragraph as a real line
break (markrahq#451, for markrahq#449). Files that wrap long lines by hand, such as list
items wrapped at 120 columns, then render as ragged short lines, while
GitHub and other CommonMark renderers join those lines into one
paragraph.

Add "Join single line breaks" under Settings > Extended syntax. It is off
by default, so the current behavior does not change. When it is on:

- soft breaks from the source render as a space, as Milkdown does by
  default;
- Shift+Enter breaks, callout lines and hard breaks (backslash or two
  trailing spaces) still render as line breaks;
- HTML and PDF export skip remark-breaks.

Only the display changes. The saved Markdown is the same in both modes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Nov 24, 2026

Copy link
Copy Markdown

@leemour is attempting to deploy a commit to the murongg's projects Team on Vercel.

A member of the Team first needs to authorize it.

@leemour
leemour marked this pull request as draft November 24, 2026 00:41
@leemour

leemour commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

Opened against the wrong branch (main, 1.x). Superseded by #800, which fixes the list alignment on v2.

@leemour leemour closed this Nov 24, 2026
@leemour
leemour deleted the feat/join-soft-line-breaks branch November 24, 2026 01:35
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.

1 participant