03 Nov 2026
Beautifying Org HTML Export
Today is election day in the United States, and if you’re eligible to vote and have already done so, thank you. While we await the results over the next several days, here’s something to help pass the time, particularly if you use Org mode HTML export in Emacs.
As with many tools that export HTML, Org mode leaves most aesthetic decisions like CSS layout and typography to the user to define. Org mode’s default HTML export output is serviceable, but why settle for that? In particular, my expectations for HTML export in 2026 are this:
- Responsive layout for comfortable viewing on both mobile and desktop displays.
- Support OS appearance changes (light/dark mode).
CSS has long supported both of the above with media queries. More recently, CSS has a light-dark() function for handling OS appearance changes.
Org mode has numerous ways to customize how CSS is used in export (see org#CSS support). For my purposes, setting the customizable variable org-html-head-extra serves my needs as it will be the default behavior for exporting Org to HTML. For any special cases, I can locally override that variable.
The Elisp I use in my Emacs initialization file is as follows:
1 2 3 | |
Using the function insert-file-contents lets me specify the CSS in a separate file. For the above example, I’ve defined my CSS in the file cc-org-html.css. Readers are welcome to use or modify cc-org-html.css to their satisfaction.
Adaptive Dark Mode
Just as I was finalizing this post, I saw this WebKit post (Introducing Adaptive Dark Mode | WebKit) pop up in my feed today: apparently Safari 27.3 beta includes support to automatically adapt a website that does not support OS appearance changes. This is an early and browser-specific feature, so I still think specifying light and dark behavior is worthwhile, especially since the light-dark() function makes this so easy to do and is widespread.
Past Articles
| 1 NOV 2026 |
Announcing mdired, or adding a chainsaw to DiredAnnouncing mdired, an Elisp package that provides commands for running SIMD-style operations on marked Dired items. read more |
| 5 OCT 2026 |
Announcing triode.elAnnouncing triode.el, a remote control interface to the Triode app from Emacs. read more |
| 28 SEP 2026 |
Announcing AquíAnnouncing Aquí, an Elisp package that obtains high-accuracy location updates on macOS using Shortcuts. read more |
| 24 SEP 2026 |
Binding the SPC key in Dired and IBufferHow I put the space bar to work in Dired and IBuffer. YMMV. read more |
| 21 SEP 2026 |
Announcing restlib - a utility library for building Emacs REST clients
|
| 24 AUG 2026 |
Announcing shazam.elAnnouncing an integration between Emacs and the Shazam music recognition service on macOS, |
| 18 AUG 2026 |
Simplifying Setup for CasualCasual v3.0 update is now available on MELPA and NonGNU ELPA with a vastly simplified setup process. read more |
| 3 AUG 2026 |
Announcing now-playing.el, an Emacs interface for the macOS Music appAnnouncing a remote control interface for the macOS Music app from Emacs, keeping in tradition of never leaving it. read more |
| 22 JUL 2026 |
Malleable Computing, Emacs, and YouSome musings on malleable computing using as an example a GitHub issues browser in Emacs. read more |
Page 1 / 20 >