gedit-markdown-preview: a full-view Markdown preview, offline, inside gedit

tooling
Markdown
Linux
opensource
A small gedit 46 plugin that renders the document you are editing with pandoc, full-view in place of the editor rather than in a split. Math renders offline as native MathML through WebKitGTK, with no JavaScript and no CDN, and Mermaid diagrams render as figures. Built for writing papers and reviewing documents without leaving the editor.
Author

Pedro Carvalho Brom

Published

August 1, 2026

Code repositorypcbrom/gedit-markdown-preview

Most Markdown previews put the rendered page in a split pane, so half the window shows raw text you are not reading and half shows a rendering you cannot edit. For prose that split is the wrong trade: when I am writing a paper or reviewing a document I want to read the page as a page, then flip back to the source to change it. gedit-markdown-preview is a small plugin for gedit 46 built around that single choice. It renders the document with pandoc, styled to resemble Apostrophe, and shows it full-view in place of the editor; one control flips between the raw view and the formatted one.

The one design decision

The preview is a toggle, not a split. Pressing it hands the whole editing area to the rendered page, so the document reads at full width instead of in a half-column. The same control flips back to the raw source. There are three ways to toggle: a button in the header bar that reflects the current mode, the Ctrl+M shortcut, and a menu entry. The rendering updates live as you type, debounced so a fast typist does not trigger a render on every keystroke.

Math and diagrams without a network

The part that took the work is offline math. $...$ and $$...$$ render as native MathML through WebKitGTK, with no JavaScript engine and no CDN request. A preview that fetches a script to typeset an equation is a preview that fails on a plane or behind a strict firewall, and it leaks the fact that you are editing a document to whoever serves the script. Rendering the math locally as MathML removes both problems: the equation is typeset by the same engine that draws the rest of the page, and nothing leaves the machine.

Mermaid diagrams render the same way, as figures: fenced ```mermaid blocks and whole .mmd files become images in the preview. Local images load from disk, whether the path is relative or a file:// URL. The preview follows the system color scheme, light or dark, so it matches the rest of the desktop.

Requirements and install

The plugin targets gedit 46, the GTK3 build shipped on Ubuntu 24.04. It needs pandoc and the WebKit2GTK 4.1 introspection package. On Debian or Ubuntu:

sudo apt-get install gedit pandoc gir1.2-webkit2-4.1

Then clone and run the installer, which copies the plugin into ~/.local/share/gedit/plugins and enables it via gsettings:

git clone https://github.com/pcbrom/gedit-markdown-preview.git
cd gedit-markdown-preview
./install.sh

The installer is idempotent: run it again to update. Re-open gedit so it re-reads its plugin list, open a .md file, and press Ctrl+M.

Where it fits

This is a utility for a specific habit: drafting and reviewing Markdown, including papers with equations and documents with diagrams, in a plain editor rather than a heavyweight IDE or a browser-based tool. It does one thing, offline, and stays out of the way.

The source is open on GitHub: github.com/pcbrom/gedit-markdown-preview. I write about this kind of work, scientific method, statistics, and AI applied with rigor, on LinkedIn: linkedin.com/in/pcbrom.