The syntax is simple: The targeted piece of text is enclosed by the curly braces { and } and an ASCII sign after the first one. x{‍^3} for example gets turned into x3.

Quick Overview

Perplex includes the following replacement codes and styles them:


These codes are substituted with the help of short regular expressions in the layout template replacements.html. It processes the Hugo variable .Content which contains the rendered Markdown content as HTML string. The procedure is safe, because Goldmark treats the curly braces and their content like any other Markdown and discards raw HTML to prevent script attacks. Should you enable raw HTML, security is not your concern anyway.

Available as a module

A copy of the replacements template gets included from a separate repository: hugo-mod-replacements.

To manipulate our generated HTML with simple regular expressions is secure and fast. But these are syntax hacks which can’t be parsed by Markdown renderers. A better solution would be to add extensions for Goldmark and for many elements there already is a relatively common syntax in other Markdown flavors. If they would be available for Goldmark, we could run a regex parser for the last time on these replacements and change them into regular extended syntax.