Skip to content

Recognize acronyms, initialisms, and other all-caps sequences #615

@Witiko

Description

@Witiko

Acronyms, initialisms, and other all-caps sequences often benefit from being typeset differently from ordinary text, but marking them up manually quickly becomes tedious. Our parser could accept a comma-separated list of words to be treated specially. When these words appear in regular text, the parser would emit dedicated renderers that would apply appropriate typographic treatment such as small caps and letter-spacing.

Here is a demonstration of the proposed interface and the expected output:

\documentclass{article}
\usepackage{markdown}
\markdownSetup {
  % Format the following words as acronyms.
  acronyms = {HTML, YAML},  % We can also easily fill this list from e.g. YAML and other external sources.
  renderers = {
    % Format acronyms as small caps.
    acronym = \textsc{\MakeLowercase{#1}},
    % Don't format acronyms in headings.
    heading* ^= \begingroup \markdownSetup { renderers = { acronym = ##1 } },
    heading* += \endgroup,
  },
}
\begin{document}
\begin{markdown}

HTML and YAML are two staples of modern tooling that often get mentioned
in the same breath, even though they live in very different layers of the stack.

\end{markdown}
\end{document}
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestluaRelated to the Lua interface and implementation

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions