Skip to content

3.14.0

Latest

Choose a tag to compare

@Witiko Witiko released this 26 Feb 19:20
· 17 commits to main since this release
0ece6ce

Enhancements

This version of the Markdown package has made the following new enhancements:

  • Support the new prepending (^=) and appending ($=) operators for renderers and renderer prototypes. (#232, #617)

  • Support the prepending and appending operators (^=, +=, and $=) for comma-list options like extensions. (#232, #621)

  • In theme witiko/diagrams, add parameter command for Mermaid diagrams. (#616, #622)

    For example, you can use different icon packs as follows:

    \documentclass{article}
    \usepackage[import=witiko/diagrams@v2]{markdown}
    \begin{document}
    \begin{markdown}
    
    ``` mermaid {command = "mmdc --iconPacks '@iconify-json/logos'"}
    architecture-beta
        group api(logos:aws-lambda)[API]
    
        service db(logos:aws-aurora)[Database] in api
        service disk1(logos:aws-glacier)[Storage] in api
        service disk2(logos:aws-s3)[Storage] in api
        service server(logos:aws-ec2)[Server] in api
    
        db:L -- R:server
        disk1:T -- B:server
        disk2:T -- B:db
    ```
    
    \end{markdown}
    \end{document}
    image
  • Recognize acronyms, initialisms, and other all-caps sequences. (suggested by @Witiko, @michal-h21, and @TeXhackse in #615 and at matrix.org, implemented in #623 and e274753..3e14fa1)

    For example, you can automatically format acronyms in your LaTeX documents as follows:

    \documentclass{article}
    \usepackage[plain]{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}},
      },
    }
    \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

    The default definitions for LaTeX also provide support for explicit markup for acronyms, as well as an integration with the glossaries package:

    \documentclass{article}
    \usepackage{microtype, hyperref}
    \usepackage[acronym]{glossaries}
    \makeglossaries
    \newacronym{html}{HTML}{hypertext markup language}
    \newacronym{yaml}{YAML}{yet another markup language}
    \usepackage[bracketed_spans]{markdown}
    \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.
    
    You may also use explicit markup: [HTML]{.acronym}. This works even if the
    acronym hasn't been registered with the glossaries package: [JSON]{.acronym}.
    
    \end{markdown}
    \printacronyms
    \end{document}

    Compile the above example document ⟨filename⟩.tex with the following commands:

    lualatex ⟨filename⟩.tex
    makeglossaries ⟨filename⟩
    lualatex ⟨filename⟩.tex
    

    This produces the following result:

    image

    If you are not using the default definitions for LaTeX (for example, when loading the package with the plain or noDefaults options), you can import the glossaries acronyms manually as follows:

    \markdownSetup {
       import = witiko/glossaries@v1,
      snippet = witiko/glossaries/import-acronyms,
    }
  • Allow absolute snippet names in \markdownSetupSnippet { ... } and \markdownSetup { snippet = ... }. (#623)

    Absolute snippet names are prefixed with a slash (/). The leading slash is stripped, and the remaining name is used as-is. In contrast, relative snippet names are prefixed with the name of the currently processed theme, if any.

    For consistency, a leading slash may also be used in \markdownSetup { theme = ... } and { import = ... }. Theme names, however, are currently always absolute, so the slash is only a syntactic normalization and has no semantic effect.

    For example, the following code also imports the glossaries acronyms:

    \markdownSetup {
      import  = /witiko/glossaries@v1,
      snippet = /witiko/glossaries/import-acronyms,
    }

    The slash before witiko/glossaries/import-acronyms ensures that the correct snippet is loaded even when used from within another theme. Without the leading slash, the snippet name would instead be resolved as ⟨current theme name⟩/witiko/glossaries/import-acronyms.

    By contrast, the slash before witiko/glossaries@v1 is optional and provided only for consistency. Therefore, the following code would have the same effect:

    \markdownSetup {
      import  =  witiko/glossaries@v1,
      snippet = /witiko/glossaries/import-acronyms,
    }