Skip to content
rcawstonPublic

About

A fast, native Markdown editor

Resources

Contributing

Stars

59 stars

Watchers

0 watching

Forks

Repository files navigation

Malgel

A fast, native Markdown editor and previewer written in pure Rust with GPUI Kit (GPUI + GPUI Component). www.malgel.com

Malgel in the light appearance

Features

  • Editor and preview side by side. A syntax-highlighted Markdown editor (tree-sitter) with line numbers, soft wrap, multi-cursor editing, find & replace and undo history, next to a live GitHub-flavored preview.
  • Two-way scroll sync. Scroll or type in the editor and the preview stays on the same block; scroll the preview and the editor follows to the matching source line. Whichever pane you are pointing at or typing in leads, so the two never fight.
  • Four layouts. Editor only, editor and preview, preview only, or Live Preview (Ctrl+1/2/3/4). Single-pane layouts center a comfortable reading column.
  • Live Preview. Write in the formatted document, as in Obsidian. The paragraph, heading, list item or table cell you are in keeps its look; Markdown marks (**, `, […](…)) appear only around the caret, so a bold word stays bold while you edit it. Click anywhere to edit there; arrow keys move on through items, cells and paragraphs; Enter starts the next list item or paragraph and ends a list or quote from an empty line; Tab nests list items and moves between cells; Ctrl-click (⌘-click) follows a link. In a table, the + at its right edge or below it adds a column or row; drag across cells and right-click to delete them (whole rows or columns go, anything less is cleared) or clear them. Code blocks, callouts and HTML are edited as written. Formatting commands, undo and paste work as in the editor.
  • Rich preview. Tables, task lists, strikethrough, fenced code with highlighting for 28 languages and a copy button, YAML front matter shown as a property list, local images (relative to the document), remote images and data: URLs.
  • GitHub alerts. > [!NOTE], [!TIP], [!IMPORTANT], [!WARNING] and [!CAUTION] render as themed callouts.
  • In your language. The interface is in English, French, Spanish, Simplified Chinese and Japanese, following the system's language or the one picked in Settings. The translations are new; corrections are welcome (see CONTRIBUTING.md).
  • Inline HTML. <small>, <sub>, <sup>, <kbd>, <mark>, <ins>, <abbr title>, <code>, <cite>, <q> and colored <span>/<font> render as they would in a browser, alongside <b>, <i>, <u>, <s> and <br>, in the preview and in HTML, PDF and Word exports. Classes are kept in HTML exports for your own style sheet; other tags are left out and the text inside them kept.
  • HTML sections. <details> with a <summary> opens and closes with a click (<details open> starts open), and align="center" or "right" on <div>, <p> and headings, or <center>, aligns what's inside: README logos, badges and titles look as they do on GitHub. Sections may hold Markdown between blank lines. PDF and Word exports print sections open, with their summary in bold.
  • Math. LaTeX formulas, inline ($…$) and display ($$…$$), are typeset in pure Rust: LaTeX is translated to Typst math and laid out by the Typst compiler with its bundled New Computer Modern Math font. Formulas sit on the text baseline, follow the theme's text color, render on a background thread and are cached. Prices like "$5 and $10" stay text.
  • Mermaid diagrams. A code block fenced as mermaid becomes a diagram — flowcharts, sequence, class, state and ER diagrams, Gantt charts, pies, mindmaps, git graphs, timelines, journeys and more — drawn in pure Rust by merman, with no browser or JavaScript. Diagrams take their colors from the current theme, render in the background in a few milliseconds, and a mistake shows the parser's message under the source instead of a blank. Click a diagram to open it in a window of its own: scroll or pinch to zoom, drag to move around, double-click to zoom in, and 0 to fit it to the window. Zoomed in, the part in view is drawn again at that size, so even small labels stay crisp.
  • Links that go somewhere. Click a link in the preview to follow it. Links to headings (#getting-started) scroll to them; links to other Markdown files open them in Malgel, at the heading they name, in a new tab or in place of the current document (a setting; Ctrl-click does the other). Web links open in your browser after showing where they lead, and other files open in their own apps once you agree.
  • Formatting commands. Bold, italic, strikethrough, inline code, links, headings, quotes, bulleted/numbered/task lists and code blocks — each toggles, and works on the selection or the word under the caret.
  • Structure that follows the keyboard. Enter continues a list item, task or quote, and ends the list on an empty item; Tab and Shift+Tab nest and un-nest items with their children; numbered lists renumber themselves. In tables, Tab and Shift+Tab move between cells and keep the columns aligned, Enter adds a row, and Format → Tidy table aligns one on demand.
  • Smart paste. Paste or drop an image and Malgel saves it in an assets folder next to the document and links it; paste a URL over selected text to link the text.
  • Copy as rich text (Ctrl+Alt+C). The selection, or the whole document, goes on the clipboard as formatted HTML (inline styles, formulas and local images embedded) for mail, word processors and web editors, with the Markdown as the plain-text alternative.
  • Go to heading. An outline palette (Ctrl+Shift+O) jumps to any heading.
  • Documents done right. Atomic saves, UTF-8 with byte-order-mark handling, CRLF files stay CRLF, unsaved-changes prompts on new, open, close and quit, recent files, drag and drop to open.
  • Nothing lost. Unsaved changes are written aside a second after you stop typing and come back after a crash. Files changed by another program reload by themselves, or, when you have unsaved edits, Malgel asks which version to keep; a file moved or deleted underneath you stays open as unsaved. The last session — documents, caret positions, folder and window — reopens on launch.
  • Export as HTML, PDF and Word. All three render alerts, math and diagrams as the preview does, embed local images, and work offline.
    • HTML: a standalone, self-styled page that follows the reader's light/dark preference, with formulas and diagrams embedded as SVG. Raw HTML in the source is escaped.
    • PDF: typeset by the Typst compiler, in-process: Libertinus Serif body text, vector math and diagrams, footnotes, repeating table headers, and installed fonts as a fallback for CJK, emoji and other scripts. Paper follows the system locale: US Letter where it's standard, A4 elsewhere.
    • Word (.docx): real heading styles (so the navigation pane works), Word lists and footnotes, tables with repeating headers, code blocks and alerts as shaded boxes, and formulas and diagrams as high-resolution images (formulas aligned to the text baseline).
  • Themes. Light, dark or follow the system, with bundled themes (Ayu, Catppuccin, Everforest, Flexoki, Gruvbox, macOS Classic, Solarized, Tokyo Night) selectable separately for light and dark.
  • Zoom. Ctrl+= / Ctrl+- scale the entire interface, not just the text.
  • Live statistics. Words (CJK-aware), characters, reading time, caret position and selection size in the status bar.

Optional features

Out of the box Malgel is a focused single-document editor. Everything below is off until turned on in Settings (Ctrl+, — the Edit menu on Linux and Windows, the Malgel menu on macOS) or the View menu:

  • Tabs. Open documents side by side; Ctrl+Tab and Ctrl+Shift+Tab switch between them. Without tabs, opening a file replaces the current one.
  • File sidebar (Ctrl+Shift+B). A folder's Markdown and text files as a tree that follows changes on disk; File → Open folder… picks the folder, or it shows the document's. Right-click to create a file or folder, rename one in place or delete it (to the system's trash), and drag files and folders onto a folder to move them. Open documents follow along.
  • Outline (Ctrl+Alt+O). The document's headings beside the editor, with the section you are in highlighted; click one to jump there.
  • Spell check. Unknown words are underlined in prose (code, math, URLs and front matter are skipped); right-click one for suggestions or to add it to your dictionary. American English is built in; any installed Hunspell dictionary works too (see Settings).
  • Focus mode (Ctrl+Shift+F, Esc to leave). Only the text, larger and centered, with everything but the current paragraph faded.

Tabs, file sidebar, outline and spell check on the dark theme

Tokyo Night Outline palette on Catppuccin Mocha
Dark appearance Go to heading

GitHub alerts and math on Catppuccin Mocha

Performance

  • The editor is GPUI Component's rope-backed code editor: edits, layout and painting touch only the visible lines, so typing stays instant in multi-megabyte files.
  • The preview parses on a background thread; bursts of keystrokes are coalesced into one parse, and only the visible blocks are laid out and painted (virtualized list).
  • Scroll sync maps top-level blocks to source lines. Lines scrolled far out of view are reached by an estimated jump that is corrected on the next frame, once the target line is laid out.
  • Statistics, the heading outline and the scroll-sync index are computed in one debounced background pass; results from stale revisions are dropped.
  • The UI redraws only when state changes. The one periodic job is checking open files for outside changes every two seconds — a metadata read per file, with contents read only when the file changed.
  • Spell checking runs on a background thread after typing pauses, and only on prose.

On a software-rendered Linux VM the window appears in about 150 ms, and typing into a 1.5 MB document keeps pace with the keyboard.

Install

Download Malgel from the releases page:

  • macOS 11+ (Apple silicon and Intel): open the .dmg and drag Malgel to Applications.
  • Windows 10+: run the -setup.exe installer, which also adds Malgel to "Open with" for Markdown files, or unzip the portable Malgel.exe.
  • Linux x86_64: make the .AppImage executable and run it, or unpack the tarball into ~/.local: tar -xzf malgel-*-linux-x86_64.tar.gz -C ~/.local --strip-components=1.

To open Markdown files in Malgel when you double-click them, use Default app for Markdown in Settings. On macOS and Linux it makes Malgel the default (from the AppImage or tarball it first adds Malgel to your applications); Windows only lets you choose a default yourself, so there it registers Malgel and opens the Default apps page in Windows Settings.

Builds made without signing certificates are unsigned (ad-hoc signed on macOS); docs/RELEASING.md explains how to open them.

Building

Malgel builds with Rust 1.99.1, which rust-toolchain.toml names: with rustup, the first build installs it. (GPUI needs at least 1.98.)

On Linux, install the libraries GPUI needs first (Ubuntu/Debian):

sudo apt install libfontconfig-dev libwayland-dev libxkbcommon-x11-dev \
  libx11-xcb-dev libssl-dev libzstd-dev libvulkan1

Then:

cargo run --release                 # opens the welcome document
cargo run --release -- notes.md     # opens a file

GPUI Kit supports macOS, Linux (Wayland and X11) and Windows. CI builds and tests Malgel on Linux and Windows on every push, and on macOS when run by hand; it has been exercised mostly on Linux.

packaging/ holds the app icon and the macOS, Windows and Linux packaging. Pushing a v* tag builds the installable packages and publishes a release; see docs/RELEASING.md, which also covers code signing.

Keyboard shortcuts

Ctrl is ⌘ on macOS.

Command Shortcut
New, Open…, Save, Save as… Ctrl+N, Ctrl+O, Ctrl+S, Ctrl+Shift+S
Export as HTML… Ctrl+Shift+E
Copy as rich text Ctrl+Alt+C
Close (tab, or window without tabs), Close window, Quit Ctrl+W, Ctrl+Shift+W, Ctrl+Q
Next / previous tab Ctrl+Tab / Ctrl+Shift+Tab
File sidebar, Outline, Focus mode Ctrl+Shift+B, Ctrl+Alt+O, Ctrl+Shift+F
Settings Ctrl+,
Editor / Editor and preview / Preview / Live Preview Ctrl+1 / Ctrl+2 / Ctrl+3 / Ctrl+4
Go to heading… Ctrl+Shift+O
Find…, Replace… Ctrl+F, Ctrl+H
Bold, Italic, Strikethrough Ctrl+B, Ctrl+I, Ctrl+Shift+X
Inline code, Link, Code block Ctrl+E, Ctrl+K, Ctrl+Shift+C
Heading 1–6 Ctrl+Alt+1 … Ctrl+Alt+6
Quote, Bulleted, Numbered, Task list Ctrl+Shift+., Ctrl+Shift+8, Ctrl+Shift+7, Ctrl+Shift+9
Zoom in / out / actual size Ctrl+=, Ctrl+-, Ctrl+0
Switch light and dark Ctrl+Shift+L

In lists and tables, Enter, Tab and Shift+Tab continue, nest and move between cells as described above; Shift+Enter always inserts a plain line break.

Settings

Preferences (appearance, themes, zoom, layout, the optional features, wrapping, line numbers, scroll sync and recent files) are saved automatically to settings.json in Malgel's folder:

  • Linux: $XDG_CONFIG_HOME/malgel (usually ~/.config/malgel)
  • macOS: ~/Library/Application Support/Malgel
  • Windows: %APPDATA%\Malgel

Set MALGEL_CONFIG_DIR to use another folder. The same folder holds session.json (the last session), recovery/ (unsaved changes, removed once saved or discarded), and dictionary.txt (words you added). Put Hunspell dictionaries (xx_YY.aff and xx_YY.dic) in its dictionaries/ folder to check other languages; on Linux the system's Hunspell dictionaries and on macOS those in ~/Library/Spelling are found too. image_folder in settings.json changes where pasted images go (default assets).

Update check

A few seconds after starting, Malgel asks GitHub's API for its latest published release and, if it's newer, offers to open the release page. That request is all it sends: nothing about you or your documents, and nothing is downloaded or installed for you. When no newer release is found, or the request fails, it says nothing. Turn it off under Settings → Updates; Help → Check for updates… (in the Malgel menu on macOS) checks at any time. Skip this version stops a release from being offered on startup again.

Project layout

Path Purpose
src/main.rs Startup: GPUI Kit, HTTP client for images, themes, key bindings, menus, window
src/workspace.rs The window: title bar, tabs, sidebars, status bar, settings, file commands, watching files, the session
src/document_view.rs One document: editor and preview, Live Preview, scroll sync, smart keys and paste, spelling, focus mode, recovery
src/live.rs Live Preview: what can be edited where, and the preview plugin that puts the editor there
src/live_editor.rs Live Preview's editor: Markdown drawn formatted and edited in place
src/live_inline.rs The formatting of a piece of Markdown and which of its marks show — pure and tested
src/live_table.rs A table being edited in Live Preview
src/smart_edit.rs List continuation and nesting, table navigation and tidying, paste as link — pure and tested
src/file_tree.rs The file sidebar: creating, renaming, deleting and moving files
src/spell.rs Spell checking of prose with Hunspell dictionaries
src/session.rs The last session and recovered unsaved changes
src/rich_copy.rs Copy as rich text
src/default_app.rs Making Malgel the default app for Markdown files on each system
src/analysis.rs Background statistics, outline and block index
src/format.rs Formatting commands as pure, tested text transforms
src/document.rs Loading and atomically saving files, line endings
src/export.rs HTML export, and HTML for the clipboard
src/pdf.rs PDF export: Markdown → Typst markup → PDF
src/docx.rs Word export
src/typst_world.rs The sandboxed Typst environment shared by math and PDF export
src/images.rs Resolving and loading image URLs relative to the document
src/preview_ext.rs Preview plugins: GitHub alerts, block and inline math, Mermaid diagrams
src/math.rs LaTeX → Typst → SVG/PNG formula rendering
src/diagram.rs Mermaid diagrams, themed, as SVG any renderer can draw
src/diagram_viewer.rs The window that shows a diagram larger, to zoom and move around
src/links.rs Where links in the preview lead: headings, documents, files, the web
src/html_inline.rs Inline HTML tags in the preview, and pairing them up for exports
src/i18n.rs, locales/app.yml The interface's language and its text in each language
src/html_block.rs HTML sections (<details>, aligned blocks) in the preview and exports, and safe HTML for HTML export
src/updates.rs Checking GitHub for a newer release
src/menus.rs, src/actions.rs Menus, actions and key bindings
src/settings.rs, src/themes.rs Preferences and theme application
build.rs, packaging/ Windows exe icon and version info; app icon, bundles and installers

Run the tests with cargo test.

Acknowledgements

Built on GPUI from Zed Industries and GPUI Kit by Longbridge. The bundled themes in themes/ come from GPUI Kit and are licensed under Apache-2.0. The bundled American English dictionary in dictionaries/ is from SCOWL via wooorm/dictionaries; its license is in dictionaries/en_US-LICENSE.txt. Mermaid diagrams are drawn by merman, a Rust implementation of Mermaid (both MIT). LaTeX math is translated to Typst by Tylax, which builds on MiTeX's parser, and typeset by Typst (all Apache-2.0).

Contributing

Issues and pull requests are welcome; see CONTRIBUTING.md. Contributions need agreement to the Contributor License Agreement, which a bot asks for on your first pull request.

License

Malgel is licensed under the Apache License, Version 2.0. Copyright 2026 Ross Cawston; see also NOTICE.

About

A fast, native Markdown editor

Resources

Contributing

Stars

59 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages