Skip to content

Open a Markdown preview in the browser - #38

Open
timsonner wants to merge 2 commits into
omacom:masterfrom
timsonner:open-browser-markdown-preview
Open

Open a Markdown preview in the browser#38
timsonner wants to merge 2 commits into
omacom:masterfrom
timsonner:open-browser-markdown-preview

Conversation

@timsonner

Copy link
Copy Markdown

Closes #3.

Ctrl+E renders the current buffer (saved or not) to HTML and opens it in the default browser. The writing app stays a source editor; the preview is a snapshot tab.

This is not the in-app reader in #26. That PR keeps a second view inside Omawrite. This one follows the request in #3 to preview in the default browser so the app stays small.

Behaviour

  • Ctrl+E writes a themed HTML file and opens it
  • Each press opens a new tab on purpose, so earlier snapshots stay around
  • Fenced JavaScript, Ruby, CSS, HTML, and similar languages are highlighted when the highlight package is installed; otherwise the code stays plain
  • Token colours, page colours, and links come from the live Omarchy colors.toml
  • Preview type matches the editor: iA Writer Mono, 20px, 65-character measure, headings the same size as body, editor code background
  • Raw HTML in the Markdown is not executed; javascript: links are stripped

Tests

./bin/test — 13 passed

Screenshots

Please drag this onto the GitHub PR (gh cannot upload images):

/home/tim/omawrite-pr-screenshots/editor-and-preview.png

Editor on the left, browser preview on the right. Headings (# / ## / ###) use a size scale in the preview.

Ctrl+E renders the current document to HTML and opens it in the
default browser. Fenced code is highlighted with highlight when
that package is installed, using the live Omarchy theme colours.
The browser preview had forced every heading to body size so it
would match the editor. Hash headings now render as h1–h6 with
distinct sizes.
@timsonner

Copy link
Copy Markdown
Author

Screenshot of Omawrite next to Chrome preview.

editor-and-preview

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.

feat: Feature Request - Markdown Preview

1 participant