Conversation
liukun
marked this pull request as draft
May 31, 2026 14:50
Add wrapIndent/firstLineIndent frontmatter keys that indent soft-wrapped continuation lines while hard line breaks stay flush. Values accept explicit CSS units (em/ch/px/pt; a bare number defaults to em); the editor resolves them to points and the preview emits them verbatim, so editor, preview, PDF export, and QuickLook stay in sync. The layout-directive keys are hidden from the preview's rendered frontmatter block (they're rendering config, not content metadata). Also hardens the editor's frontmatter syntax highlighting: a leading '--- ... ---' block is recognized structurally, so a half-typed field line (e.g. a key without its colon yet) no longer drops the whole block's highlight or the live indent refresh.
liukun
marked this pull request as ready for review
May 31, 2026 14:54
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.
What
Adds two opt-in frontmatter keys that indent soft-wrapped (auto-wrapped) continuation lines while hard line breaks stay flush left:
Values accept explicit CSS units (
em,ch,px,pt); a bare number defaults toem. The editor resolves them toNSParagraphStylepoints and the preview emits them verbatim as CSS, so the editor, WKWebView preview, PDFexport, and QuickLook all render the same indent.
When neither key is present, nothing changes — the default behavior is completely untouched.
Also includes a small editor fix: a leading
--- … ---block is now recognized structurally, so a half-typed frontmatter field (e.g. a key before its colon) no longer drops the block's syntax highlighting or the live indent — a pre-existing display glitch, surfaced while testing this feature.Why
For log / changelog / reference-style notes, a hanging indent makes wrapped lines line up under a leading column (timestamp, key, citation, etc.) and visually distinguishes a soft wrap from a deliberate hard break. Several editors (and a popular Obsidian CSS snippet,
--wrap-indent) and Emacs'visual-wrap-extra-indentdo exactly this. I wanted it for a specific set of my own documents.Scope / design notes
I tried to keep this in line with the project's "stay boring" philosophy:
ClearlyCore(shared), so Mac and iOS behave identically, and the same value feeds preview/PDF/QuickLook.ClearlyCoresuite is green (swift test --package-path Packages/ClearlyCore).A note on stance
This scratches a personal itch for specific documents — I completely understand if niche per-document layout knobs aren't a direction you want for Clearly, and it's totally fine if this doesn't get merged. Sharing it in case it's useful.
Either way: thank you for open-sourcing such a clean, genuinely pleasant markdown editor. It's a joy to use, and the codebase was a pleasure to work in.