Skip to content

Add reader view and document text zoom - #26

Open
smillunchick wants to merge 1 commit into
omacom:masterfrom
smillunchick:feature/reader-view-and-text-zoom
Open

Add reader view and document text zoom#26
smillunchick wants to merge 1 commit into
omacom:masterfrom
smillunchick:feature/reader-view-and-text-zoom

Conversation

@smillunchick

Copy link
Copy Markdown

Summary

Omawrite can now switch between Markdown editing and a formatted, selectable reader view without leaving the document. Document text can be resized independently from desktop scaling, and fenced code is easier to distinguish in both views.

Reader mode keeps separate scroll positions for reading and editing. It renders with the active Omarchy theme, copies selected content as HTML and plain text, and blocks raw Markdown HTML and remote images.

Fenced code remains literal in the editor, so Markdown markers inside code are not hidden or styled as prose. Reader typography uses explicit line height and block spacing so headings, paragraphs, and lists remain readable.

Validation

  • ./bin/test — 17 tests passed
  • ./bin/build
  • Loaded and visually checked bd-hiring-plan.md in both views
  • Verified rich-text clipboard data, zoom controls, keyboard navigation, and theme-aware code panels

@greptile-apps

greptile-apps Bot commented Aug 26, 2026

Copy link
Copy Markdown

Greptile Summary

Omawrite adds a selectable rich-text reader view, independent document zoom, and stateful fenced-code presentation.

  • Renders GitHub-flavored Markdown with theme-aware typography, code panels, restricted links, and remote-image removal.
  • Preserves separate reader/editor scroll positions and adds reader-focused keyboard and search transitions.
  • Updates editor highlighting so fenced code remains literal and expands backend/QML integration coverage.

Confidence Score: 4/5

The fence recognizer should be aligned with the reader’s Markdown dialect before merging so valid documents cannot receive inconsistent code styling and caret behavior.

The new editor state machine blindly toggles on lines matching an approximate three-backtick regex, causing valid GitHub-flavored fence forms and delimiter-length cases to be interpreted differently between editing and reader views.

Files Needing Attention: src/markdownhighlighter.cpp, src/Main.qml, tests/tst_omawrite.cpp

Important Files Changed

Filename Overview
src/Main.qml Adds reader mode, document zoom, independent scroll state, rich-text selection, and mode-aware focus and keyboard behavior.
src/backend.cpp Adds Markdown-to-HTML rendering, theme-aware reader formatting, remote-image removal, and fenced-block caret integration.
src/backend.h Exposes the new Markdown rendering method through the QML-facing backend API.
src/markdownhighlighter.cpp Adds theme-derived code backgrounds and stateful fenced-code highlighting, but its fence recognizer diverges from the reader dialect.
src/markdownhighlighter.h Adds shared code-color calculation and persistent fenced-block states.
tests/tst_omawrite.cpp Expands coverage for reader rendering, sanitization, copy behavior, zoom, navigation, spacing, and basic backtick fences, but omits alternate and mismatched fence forms.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
    Source[Markdown editor] -->|text changes| Backend[Backend renderMarkdown]
    Backend -->|sanitized themed HTML| Reader[Reader TextEdit]
    Source --> Highlighter[MarkdownHighlighter]
    Highlighter -->|block state and formats| Source
    Toggle[Reader/Edit toggle] --> Source
    Toggle --> Reader
    Zoom[Document zoom] --> Source
    Zoom --> Backend
    Zoom --> Reader
Loading

Reviews (1): Last reviewed commit: "Add reader view and document text zoom" | Re-trigger Greptile

Comment on lines +147 to +149
bool MarkdownHighlighter::isFence(const QString &text) {
static const QRegularExpression fenceRe(QStringLiteral("^\\s*```"));
return fenceRe.match(text).hasMatch();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Fence state misclassifies Markdown

When a document uses a valid tilde fence, a longer backtick fence containing a shorter backtick run, or an indented code line beginning with three backticks, isFence() disagrees with the GitHub Markdown dialect used by reader view and blindly toggles block state. This styles valid code as prose or surrounding prose as code, and makes editor caret behavior disagree with the rendered document.

Knowledge Base Used:

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