Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MDR

MDR is a native GTK Markdown reader. Give it a file and it opens a plain, scrollable reading window. There is no editor, toolbar, tab bar, file browser, account, plugin system, or web engine.

Text can be selected and copied. File-backed documents reload when they change on disk, so MDR works well beside an editor. Each file opens in its own window.

Markdown support

MDR uses cmark-gfm and supports CommonMark together with the usual GitHub extensions. This includes headings, emphasis, links, block quotes, lists, task lists, tables, fenced code, footnotes, alerts, and local images.

Some behavior is deliberately conservative:

  • Raw HTML is shown as text and is never executed. <br> is honored in table cells.
  • Remote images are shown as links instead of being downloaded.
  • Clickable links are limited to http, https, mailto, and local paths.
  • Math syntax is not extended. Dollar signs and TeX commands remain ordinary Markdown text.

Large files

MDR builds the complete GTK document before showing it. This keeps scrolling and reloads predictable, but memory use and layout time grow with the file. Large documents can take a while to open and may use substantial memory. Input is limited to 64 MiB.

Build and install

MDR requires GTK 4.14 or newer and libcmark-gfm 0.29 or newer. On Arch Linux:

sudo pacman -S --needed base-devel gtk4 cmark-gfm

Build a development binary:

make
./build/mdr README.md

Build and install an optimized binary for the current user:

make release
make install PREFIX="$HOME/.local"

CC, CFLAGS, LDFLAGS, PREFIX, BINDIR, MANDIR, and DESTDIR may be overridden by the caller.

Usage

mdr FILE...        open one window for each file
mdr -              read Markdown from standard input
mdr --check FILE   parse a file without opening a window
mdr --help         show command-line help
mdr --version      show the version
mdr -- FILE...     treat later arguments as file names

Standard input is read once. It has no path, so it cannot reload and relative links are resolved from the current directory.

Keys

Key Action
j, k, arrow keys Scroll by three text lines
Space, Backspace Next or previous page
Ctrl-d, Ctrl-u Down or up by half a page
g, Home Start of the document
G, End End of the document
Ctrl-c Copy selected text
Ctrl-+, Ctrl--, Ctrl-0 Change or reset zoom
q, Esc Close the window

Styling

User styles are read from $XDG_CONFIG_HOME/mdr/style.css, or ~/.config/mdr/style.css when XDG_CONFIG_HOME is not set. Create the directory before starting MDR if you want style changes to reload while the window is open.

.markdown-document {
  font-family: "Source Han Serif SC", serif;
}

.md-code-block,
.md-html-block,
.md-list-marker {
  font-family: "JetBrains Mono", monospace;
}

The whole stylesheet is passed to GTK. Fonts, colors, spacing, borders, and @import rules can be changed without rebuilding MDR.

See mdr(1) for the full command reference.

About

A native GTK Markdown reader

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages