Welcome to my personal site. In addition to the posts you see below, feel free to explore other places where I stash content here. The now page is an occasionally-updated page about long-term plans and activities. I try to post several times a week and those updates appear on the journal page. Sometimes I post tidbits about things I learn in the til page. More info in: toolkit, readings, to learn, gallery, and colophon.

fancy_quote shortcode for Hugo for fancier quotes

The fancy quote shortcode displaying highlighted passages from James C. Scott

I often include quotations in blog posts, but a plain Markdown blockquote does not give much control over the presentation and attribution. I wanted a reusable component that would keep the quote, author, source and publication year visually consistent without requiring me to reproduce the same HTML in every post.

The result is a fancy_quote shortcode, which adds large typographic quotation marks, centres the source and author beneath the quotation, and allows one or more passages to be highlighted with a simple ==highlighted text== notation.

Features

  • The quotation can be written between the shortcode’s opening and closing tags or supplied through a text parameter.
  • author, source and year are optional named parameters.
  • Any number of ranges can be highlighted.
  • Highlighted passages use the semantic HTML <mark> element rather than a purely decorative <span>.
  • Highlights can wrap across lines without losing their padding.
  • Existing quotations without highlights continue to render normally.
  • The appearance is controlled entirely by CSS and can be adapted to any theme.

Hugo version

The shortcode requires Hugo 0.16 or newer. The limiting feature is replaceRE, which converts the highlight delimiters into <mark> elements and was added in the Hugo 0.16 release. The other pieces use the standard shortcode .Get and .Inner methods and the long-established safeHTML alias for safe.HTML.

I developed and tested this version with Hugo 0.165.0. It does not require Hugo Extended, JavaScript, or any external library.

The shortcode

Create layouts/shortcodes/fancy_quote.html in the root of the Hugo project:

{{ $year := .Get "year" }}
{{ $text := .Get "text" | default .Inner }}
{{ $author := .Get "author" }}
{{ $source := .Get "source" }}
{{ $text = replaceRE `==([^=]+?)==` `<mark class="quote-highlight">$1</mark>` $text }}

<div class="fancy-quote">
  <p class="quote-text">{{ $text | safeHTML }}</p>

  {{ if or $source $year }}
  <div class="quote-meta">
    {{ if $source }}
    <span class="quote-source">{{ $source }}</span>
    {{ end }}
    {{ if $year }}
    <span class="quote-year">({{ $year }})</span>
    {{ end }}
  </div>
  {{ end }}

  {{ if $author }}
  <div class="quote-author">{{ $author }}</div>
  {{ end }}
</div>

The regular expression looks for text enclosed by pairs of equals signs. Each match is replaced by a <mark class="quote-highlight"> element. Piping the result through safeHTML prevents Hugo from escaping the generated element.

safeHTML should be used only with content that I control. If quotation text comes from an untrusted visitor, CMS user, or external feed, it should be sanitised rather than passed through this shortcode unchanged.

The CSS

Here is the complete stylesheet:

.fancy-quote {
  font-family: "Georgia", "Times New Roman", serif;
  line-height: 1.6;
  max-width: 100%;
}

.quote-text {
  position: relative;
  text-align: justify;
  margin-bottom: 1rem;
  padding: 0.2rem 2.4rem 0.35rem;
  font-size: 1.05rem;
}

.quote-text::before,
.quote-text::after {
  position: absolute;
  color: #999;
  font-size: 2.75rem;
  font-weight: bold;
  line-height: 1;
}

.quote-text::before {
  content: "“";
  top: -0.15rem;
  left: 0.8rem;
}

.quote-text::after {
  content: "”";
  right: 0;
  bottom: -0.8rem;
}

.quote-highlight {
  color: inherit;
  background-color: #fff0a6;
  padding: 0.05em 0.12em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.quote-meta {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 0.25em;
  text-align: center;
  line-height: 1.3;
}

.quote-year {
  font-style: normal;
  font-size: 1.25rem;
  white-space: nowrap;
}

.quote-source {
  font-style: italic;
  font-size: 1.25rem;
}

.quote-author {
  display: block;
  text-align: center;
  margin-top: 0.25rem;
  margin-left: auto;
  margin-right: auto;
  font-size: 1.1rem;
}

The stylesheet can be saved as static/css/fancy-quote.css and included in the site’s <head>:

<link rel="stylesheet" href="/css/fancy-quote.css">

Sites already using Hugo Pipes can instead keep the file under assets/css and add it to their existing CSS bundle.

Using the shortcode

A complete quotation looks like this:

{{< fancy_quote
  author="James C. Scott"
  source="Two Cheers for Anarchism"
  year="2012" >}}
The point is simply that ==huge disparities in wealth, property, and status make a mockery of freedom.== A second range can be ==highlighted independently==.
{{< /fancy_quote >}}

The highlight markers are optional. Without them, the entire quotation is displayed in the same style:

{{< fancy_quote author="Ursula K. Le Guin" >}}
The creative adult is the child who survived.
{{< /fancy_quote >}}

For a short quotation, the text can be supplied as a parameter and the closing tag omitted:

{{< fancy_quote
  text="The creative adult is the child who survived."
  author="Ursula K. Le Guin"
>}}

Optional adaptations

The shortcode parameters are independent. A quote can have an author but no source, a source and year but no author, or no attribution at all. The highlighting feature is also entirely optional.

The CSS is deliberately uncomplicated. The highlight colour can be changed through background-color, and the font, quotation-mark size, spacing and attribution alignment can all be altered without touching the shortcode. A dark theme might override the highlight colour inside its existing dark-mode media query:

@media (prefers-color-scheme: dark) {
  .quote-highlight {
    background-color: #665500;
  }
}

The shortcode intentionally treats its inner text as text with optional highlight markers, rather than running it through the Markdown renderer. That keeps its output predictable. If links, emphasis or other Markdown inside quotations become necessary, the rendering step could be extended with Hugo’s Page.RenderString method, with suitable care around generated and untrusted HTML.

For my purposes, this provides a small, readable content syntax while keeping all of the presentational machinery in one reusable place. If you have any difficulties, suggestions for improvements, please contact me via my contact page

A better user experience when a Firefox extension loads a new tab custom page

N.B. This workaround is for macOS, using Keyboard Maestro. I have not tried equivalents elsewhere. On Windows, AutoHotkey can bind a hotkey, send Ctrl+T, select and clear the address bar, then Escape. On Linux, AutoKey is the usual analogue; under Wayland you may need something like ydotool. The Firefox new-tab focus behaviour itself is not macOS-specific.

In the previous post I described Slinky, a self-hosted start page, and mentioned that I use the New Tab Override extension so Firefox opens it on every new tab. That works, but the default behaviour is a little ugly.

Firefox puts the cursor at the beginning of the address bar when a new tab opens. So if I create a tab to search for “dog food” my sequence of actions would typically be:

  1. Command+T to create new tab.
  2. Slinky page opens as expected.
  3. Start typing “dog food” but notice that what appears in the URL bar is dog foodhttp://<slinky address>.

There’s a lot of discusson on Bugzilla about this. The bottom line is that this is intended behaviour for Firefox. They don’t want a situation where new tab creation goes to an anonymous location.

The way I work around this is to use ^T not ⌘T to create a new tab. And in Keyboard Maestro, which I’ve written a lot about, I have a Firefox-targeted macro that triggers on ^T and then:

  1. Creates a new tab with ⌘T.
  2. Selects the URL bar contents.
  3. Deletes the contents.
  4. Escapes out of the URL bar.
Keyboard Maestro macro Firefox new tab and clear URL

You can download the Keyboard Maestro macro Firefox new tab and clear URL from this site.

The rest of New Tab Override’s options — tab position, containers, a local HTML file instead of a URL — are documented in the extension and its README.

If you run into trouble, see my contact page.

Slinky: A self-hosted start page

A colorful, retro-style graphic illustration of a circular slinky coil featuring red, yellow, and teal segments on a cream background.

One of the browser conveniences that I appreciate is ready access to commonly used links, presented in a neat and categorized way. Every time I create a new tab, I just want to see those links. There are of course many browser extensions that present a page when the user opens a new tab. Mozilla has its own default ad-ridden page on Firefox. For my part, I don’t want news, weather, “trending stories,” or ads. I just want my curated links. That’s why I created Slinky.

Donald Trump’s pseudo-principles of adult behaviour

I’ll admit to being a pushover for lists of pithy advice for living. One that I return to frequently are those compiled by John Perry Barlow.

In 1977, John Perry Barlow wrote a list of twenty-five principles of adult behaviour.

Reading through these principles in the midst of the self-serving, self-enriching careless chaos that Donald Trump has wreaked on the world, I decided to write a parallel set of principles as Trump himself might do. I give you - by way of contrast - Donald Trump’s Principles of Adult Behaviour.

Updated: ARINC 424 parser & explainer

Yesterday I posted about a small utility that parses and explains ARINC 424 records. I have updated it.

For each field, the tool now cites the specific tables in the ARINC 424 specification that describe that field. The field-content explanations are also more detailed, so you can spend less time flipping between the parsed output and the printed standard. Here is an example for an Airport SID/STAR/Approach primary record:

This is still a work in progress. Not all record types are supported yet; I am filling those in as I need them.

A small utility to parse and explain ARINC 424 records

N.B. An enhanced version is now available, with specification table references and more detailed field explanations. 2026-08-03.

The ARINC 424 specification is the universally accepted standard for encoding aeronautical navigation data. Databases that follow it store that data in fixed-length, 132-character records. I created a utility that parses a single ARINC 424 record and prints the fields along with column numbers and plain-language explanations. The Python arinc424 module does the heavy lifting; I provide a wrapper around it, plus the logic that maps fields to the column numbers used in the official specification.

Violentmonkey script to block politicalwire.com troll “Reasonable”

The news site politicalwire.com is a well-regarded site that covers U.S. political news. Like other similar sites, it features a comment section; and like many comment sections on political sites, it attracts personality-disordered internet trolls. One such troll on politicalwire.com goes by the handle Reasonable. This commenter is a troll in every sense of the word, engaging users with deliberately provocative nonsense.

This user has been banned on multiple occasions and escapes both bans and blocks by repeatedly creating new Disqus accounts using the same name and avatar. Since it cannot be blocked at the account/server level, I’ve written a Violentmonkey script to expunge his comments at the level of the browser. To use the script, you will need to use the Violentmonkey (or related) extension and create a new script with the following code. It works perfectly in Firefox.

Lua script for X-Plane 12 fuel management

As a Challenger 650 captain, I fly routes between North America and Europe with some frequency. Dealing with the interconversion of imperial and metric units is a challenge; so I create a Lua script that runs in the X-Plane FlyWithLua plugin.

Once installed, the script allows you to enter the required trip fuel, current onboard fuel, fuel density and metric vs imperial units and outputs the desired fuel uplift. You can also select to take 10%, 15%, 20% extra fuel. This is a feature that I added because SimBrief seems to underestimate my fuel burn.

Keyboard Maestro macro to toggle macOS calendar visibility

As a pianist, I use Calendar on macOS and iOS to plan each day’s practice. On heavy days I may have over a dozen practice blocks, so the calendar gets crowded quickly and it becomes easy to miss non-practice events. A calendar that looks like this makes the problem obvious:

What I really wanted was a quick way to toggle a group of calendars at once on macOS. In my case, that group is the set of works I am currently practicing (for example, specific Brahms and Schubert calendars). Your grouping might be completely different, depending on your purpose, but the same approach applies.

A script to generate KiCad board outlines

PCB fabricators require a board outline on the `Edge.Cuts` layer to specify the board size and shape. While drawing the board outline in the PCB editor is straightforward and uses the standard line and shape drawing tools, it is convenient to retain standardized board outlines and related parts, such as fasteners, as reusable footprints. During the board layout process, you can simply plop a board outline, along with perfectly-placed mounting holes into the editor and you can concentrate on placing components and routing. Also, having a standard library of board outlines gives you a predictable set of size choices for enclosures and for ordering SMD stencils.

This is why I created KiCadBoardOutlineGenerator, a script to generate board outlines from dimensions you specify.