Skip to content
vflame6Public

About

Small native macOS Markdown reader and editor.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

Uncial

Uncial is a small native macOS Markdown reader and editor.

Created by Maksim Radaev/@vflame6

uncial

Features

  • GitHub-flavored Markdown: tables, task lists, strikethrough, autolinks, footnotes, fenced code, raw HTML, LaTeX math and Mermaid diagrams, rendered without running any script in the page.
  • Syntax highlighting in fenced code for about 50 languages, from Python, JavaScript, TypeScript, Java, C, C++, C#, Go, Rust, Swift, Kotlin, Ruby, PHP, SQL and shell to Fortran, COBOL, Prolog, MATLAB, Pascal and Scratch, plus JSON, YAML, HTML, CSS, diff and more, with colors that follow the theme in the rendered page, in Quick Look and in the editor.
  • Four modes per window: Read Only, Live Preview (Markdown rendered in place), Split View and Raw Editor.
  • Three themes, each with a light and a dark variant: macOS, GitHub and Solarized.
  • A Markdown-aware source editor: syntax coloring, auto-closing pairs, list and quote continuation, find and replace, optional line numbers, and scroll sync in Split View.
  • Save with ⌘S, or let Uncial save as you type.
  • Export to PDF or HTML with File ▸ Export… (⌘P): a PDF on your paper size with page numbers, or a single HTML file that carries its pictures, diagrams and styles and looks the same in any browser.
  • An uncial command for the terminal: uncial notes.md opens the note in Uncial, and creates it first if it does not exist yet.
  • Re-rendering when the file changes on disk, scroll position kept.
  • Local images, heading anchors, YAML front matter, and links that open in the browser or, for local Markdown files, in a new window. A link to any other file or kind of address asks first, naming the app that would open it, and a link to a program, script or installer never opens it (Uncial offers to show it in Finder instead). Images and other files from the web load by default (in Live Preview, pictures only, up to 20 MB and 30 seconds each); turn off Load images and other files from the web in Settings ▸ General and they stay unloaded in the window, in Live Preview, in the diagrams and in Quick Look, so opening a file tells no server about it.
  • Attachments found where you keep them: an image or linked file that is not next to the document is looked for in its attachments folder and then, folder by folder, above the document. Settings ▸ General sets the folder name, whether the folders above are searched, and whether the search stops at your home folder or at the root of the disk.
  • Paste or drop files and pictures into the editor: the Markdown for them, an image or a link, is inserted at the cursor. A file the document already reaches (in its folder, in an attachments folder, or another note) is linked where it is, and so is a folder that holds the document; anything else is copied where new attachments go (Settings ▸ General chooses the folder, created as needed).
  • Obsidian-style callouts: a quote that starts with [!note], [!tip], [!warning] or any other of Obsidian's default types (aliases included) becomes a tinted box with the type's icon and a title, in the page, in Quick Look and in Live Preview; [!type]- and [!type]+ fold in the page.
  • Quick Look preview and thumbnails for Markdown files. The preview takes the app's theme and its Appearance setting: set to Light or Dark, previews stay light or dark whatever the system uses; System follows the system.
  • Optional status bar with line, word and character counts. Pinch to zoom.

Requirements

  • macOS 14 Sonoma or later.
  • Xcode 26 to build from source.

Install

With Homebrew:

brew tap vflame6/uncial https://github.com/vflame6/uncial
brew trust vflame6/uncial
brew install --cask uncial

The cask also puts the uncial command on your PATH.

From source:

git clone https://github.com/vflame6/uncial.git
cd uncial
make install

make install builds a Release Uncial.app, copies it to /Applications, launches it once so macOS registers the Quick Look extensions, and clears the Quick Look cache. You can also open uncial.xcodeproj in Xcode, pick the uncial scheme, and run.

The project signs with the maintainer's development team, whose certificate only the maintainer has. Without it, sign the build ad hoc:

make install SIGN_IDENTITY=-

Without Homebrew, open Settings ▸ General ▸ Command Line and click Install to put the uncial command in /usr/local/bin (macOS asks for an administrator password when that folder is not yours). The command opens the copy of Uncial it belongs to, so keep the app in /Applications.

Enabling the Quick Look extensions

  1. Select any .md file in Finder and press Space. You should see the rendered document, and the file's icon should show a small page of it.

  2. If you still see plain text, open System Settings ▸ General ▸ Login Items & Extensions ▸ Quick Look and enable Uncial Quick Look (previews) and Uncial Thumbnails (icons and Open panels). (On macOS 14 the switches live under Privacy & Security ▸ Extensions ▸ Quick Look.)

  3. Reset Quick Look if needed; the cache reset also throws away old thumbnails:

    qlmanage -r && qlmanage -r cache

Only one Quick Look extension can preview a file type, and one can draw its thumbnails. If another Markdown previewer is installed (QLMarkdown, Peek, Marked, …), disable it in the same settings pane or macOS may keep using it.

Usage

  • Right-click a Markdown file ▸ Open With ▸ Uncial, drop it on the Dock icon, or run uncial README.md (see below) or open -a Uncial README.md. Uncial and its Quick Look extensions handle .md and .markdown files as well as .mdown, .mkd, .mkdn, .mkdown, .mdwn, .mdtxt and .mdtext.
  • File ▸ Open (⌘O) and Open Recent work as in any document app. File ▸ New… (⌘N) asks where to create an empty Markdown file and opens it.
  • File ▸ Export… (⌘P) saves what the window shows, edits not yet saved included, as a PDF or an HTML file (Format, in the save panel; Uncial remembers the last one). The PDF is light, on the paper size macOS uses by default (A4 or US Letter), with page numbers, and folded callouts print open. The HTML page follows the reader's light or dark setting and keeps any script in the document from running.
  • In Terminal, uncial opens Uncial, uncial notes.md opens a note (created empty when it does not exist yet and its name ends in .md or another Markdown extension), and uncial *.md opens several.
  • View ▸ Reload (⌘R) re-reads the file if you ever need to force it.
  • Settings (⌘,) opens on General (appearance, theme, Quick Look, default app, attachments, loading from the web); the other tabs are Editor, Shortcuts and About. The General controls are offered once in a Welcome window on first launch.

Editing

Every document window has a mode, chosen with the segmented control in the toolbar, the View menu, or the keyboard:

Mode Shows Shortcut
Read Only The rendered document ⌥⌘1
Live Preview One editor with the Markdown rendered in place; the line with the cursor shows its source ⌥⌘2
Split View Markdown source on the left, rendered document on the right ⌥⌘3
Raw Editor Markdown source only ⌥⌘4

⇧⌘E cycles through the four. New windows start in the mode chosen in Settings ▸ Editor (Split View by default). A document's window opens where it was when you last closed it, at the size it had; a document you have not opened before opens where the last window was.

Edits stay in the window until you save with ⌘S: a window with unsaved changes shows Edited under its title and the dot in its close button, and closing it, quitting or reloading asks whether to save. Turn on Save changes automatically in Settings ▸ Editor to have Uncial write the file half a second after you stop typing instead, without asking. If another program changes the file while you have no unsaved edits, the window picks up the new contents. With unsaved edits, Uncial asks whether to keep them or reload the file (Settings ▸ Editor can make it keep or reload without asking), and before every save it re-reads the file, so a change made by Git, a sync service or another editor in the meantime is never overwritten blindly. When saving automatically fails (a locked file, a folder you cannot write to, a full disk), closing and quitting ask as they do for manual saving. A file renamed or moved while it is open is saved where it is now. Files in an older text encoding (Latin-1, Windows-1252, Shift-JIS, …) are saved back in it; UTF-8 and UTF-16 files are saved as UTF-8.

Live Preview renders Markdown where it stands, in the theme's page fonts and sizes: headings, emphasis, code, links, lists, task boxes, quotes, tables, images, diagrams and math. The line under the cursor (or the fenced block it is in) shows its source instead, in the Raw Editor's monospace look with every marker, on a tinted band with room above and below, and returns to the rendered look when the cursor leaves; a picture stays under its line meanwhile. In Split View the source and the rendered page scroll together. Settings ▸ Editor holds the editor options: line numbers, auto-closing of brackets and Markdown markers, list and quote continuation, text size, the readable column in Live Preview, scroll sync and the split ratio. Edit ▸ Find (⌘F) and Find and Replace… (⌥⌘F) search the source, or the rendered page in Read Only.

Development

make core-test   # unit tests for the renderer and watcher (swift test)
make test        # core tests + app unit tests via xcodebuild
make build       # Release build into ./build
make highlight   # rebuild the highlight.js bundle (scripts/build-highlight.sh)
make mermaid     # rebuild the beautiful-mermaid bundle (scripts/build-mermaid.sh)
make release 1.2.0   # publish version 1.2.0 (maintainers)
make clean

static/demo.md exercises every rendering and editing feature with an Expect note per section; open it in each mode to check a change by eye.

make release x.y.z publishes a version from a clean main that is up to date with GitHub, with gh logged in. It runs the tests, sets the version, builds and checks the app, zips it, points the Homebrew cask at the zip, then commits, tags and pushes everything at once. Finally it creates the GitHub release and checks the uploaded zip against the cask. A failure before the push leaves the repository as it was. After a later failure, run the same command again to complete the release.

The Makefile exports DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer, so the commands work even when xcode-select points at the Command Line Tools. Override it with make DEVELOPER_DIR=/path/to/Xcode.app/Contents/Developer ….

Project structure

Part What it does
Packages/UncialCore Swift package. Turns Markdown into a self-contained HTML page: cmark-gfm parsing, heading ids, front matter, math (KaTeX), diagrams (beautiful-mermaid) and code highlighting (highlight.js) done through JavaScriptCore at render time, image inlining, and the three themes as CSS. Also the file watcher and the block outline the thumbnails draw.
uncial (app target) SwiftUI document app. Shows the HTML in a WKWebView with page JavaScript disabled and swaps the rendered body in place as you type. An NSTextView provides the editor; the view model keeps the editor's text, writes it to the file on ⌘S (or as you type, when automatic saving is on) and reconciles changes that arrive from other programs. A hidden web view runs mermaid.js for the diagram types beautiful-mermaid lacks and draws every diagram to a bitmap for Live Preview. Settings and the first-run Welcome window drive pluginkit and NSWorkspace for the two system integrations. File ▸ Export prints the page to PDF in a hidden web view (PDFKit numbers the pages) or writes it as one HTML file; Resources/uncial is the shell command.
UncialQuickLook Quick Look Preview Extension. Returns the same HTML through QLPreviewReply, so Finder renders it. Reads the theme, the appearance, and the diagrams mermaid.js drew in the app, from the App Group container the app writes to (WebKit cannot run inside the extension).
UncialThumbnail Quick Look Thumbnail Extension. Draws the document's outline (headings, text, lists, quotes, code, rules, tables) as a small page with AppKit for Finder icons, Open panels and Get Info, in the theme's light colors.

Contributing

Feel free to open an issue if something does not work, or if you have any ideas to improve the tool.

About

Small native macOS Markdown reader and editor.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages