“Auto-Smallcaps Filter”, Gwern2020-02-19 (, , ; similar)⁠:

Description of a Pandoc plugin I wrote for use on Gwern.net which automatically rewrites any string text of 3 or more capital letters (eg. “NSA” or “GAN” or “NASA”) to rendered with small caps in CSS, which are typographically nicer to read as the small caps make the acronyms less visually overwhelming compared to regular capital letters.

This is trickier to implement than the usual Pandoc plugin because strings must be parsed and broken up, so it’s not a straightforward 1-for-1 substitution, and I explain the necessary recursive tricks to make it correct & typecheck.