HUGO

OT: Font Ligatures in Hugo-rendered code blocks?

Hello there. Out of curiosity and love for fonts with font ligatures, I have a question.

Assuming that,

  • I have installed a relevant font (such as Fira Code) into my project, and
  • set <code> blocks to import and use that font-family in CSS,

will Goldmark render code blocks with font ligatures?

Is there a way to make it happen, perhaps with the font-variant-ligatures CSS property?

Is there a way to make it happen, perhaps with the font-variant-ligatures CSS property?

Hugo and in extension Goldmark will do what you tell them. There is no “markdown way” to add ligatures to your font. The only way to do that is via CSS:

https://developer.mozilla.org/en-US/docs/Web/CSS/font-variant-ligatures

So… it’s not a Hugo-thing. It’s just CSS.