Skip to main content

A MkDocs plugin that automatically creates references to glossary terms within italicized text from a specified glossary list file.

Project description

mkdocs-glossary

A MkDocs plugin that automatically creates references to glossary terms within italicized text from a specified glossary list file.

Setup

Installing using pip:

pip install mkdocs-glossary

Config

You need to activate the plugin in mkdocs.yml:

plugins:
  - glossary:
      file: "file_name" # Optional --> Default : glossary.md
      exclude: # Optional --> Default : None
        - 'excluded term A'
        - 'excluded term B'
        - '...'
      unknown_warning: true # Optional --> Default : false
  • file - The filename, from docs root folder, of the Markdown file containing the glossary list.
  • exclude - This is a list of all the terms, case insensitive, that you want the plugin to ignore.
  • unknown_warning - This option allow the plugin to create warning on founded term that are not in glossary list or exclude list.

Usage

How it work

The plugin will look for Markdown italic text. It will ignore italic placed in headers, links text, images alt text, code and code blocks. It will then check if the text is part of the glossary list from the glossary file and create a reference next to the text.

To create that reference to the definition it will use a superscript number inside a Markdown link element. To correctly render superscript this plugin require a way to render them. I recommend using pymdownx.caret markdown extension via mkdocs-material.

You can set the pymdownx.caret markdown extension like this in your mkdocs.yml.

markdown_extensions:
  - pymdownx.caret

Using the command mkdocs build or mkdocs serve will trigger the plugin.

Glossary list

For the glossary list inside the glossary file you have to respect this format

First, create a Markdown ordered list like in the usual way.

1. Something
2. Something else

Secondly place each terms between Markdown bold characters. you can separate variantes that have the same description by using comma.

1. **Term A**
2. **Term B, Variant B1**

Finnaly you can add your description the same way you would write any text just after a space, a colon and another space

1. **Term A** : Term A Description
2. **Term B, Variant B1** : *Term B* **Important Descripiton** See : [link](.)

About Extended Markdown Definition List

I'm aware of the Extended Markdown Definition List element but it's supposed to generate a definition at the end of a page/document and since i don't want to interfere with any plugins that would use it the proper way i had to come up with another way to write and read the glossary list.

Notes

Note that most Markdown interpreter will automaticaly manage numbers or ordered list so it have no importance if you use accurate number on the glossary list. The plugin just do a simple increment at each new entry.

Be aware that multiple ordered list that follow the glossary list rules would work but would create confusion with user since the numbers shown on the glossary lists would not correspond to the ones used by the plugin to reference terms in the documentation.

By the way any italic words contained in the glossary file will be ignored by the plugin.

License

This project is under MIT license. See the license file for more details.

See Also

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mkdocs-glossary-0.1.2.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mkdocs_glossary-0.1.2-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file mkdocs-glossary-0.1.2.tar.gz.

File metadata

  • Download URL: mkdocs-glossary-0.1.2.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.10

File hashes

Hashes for mkdocs-glossary-0.1.2.tar.gz
Algorithm Hash digest
SHA256 98850ba6b3428403c7ef21f4522f78846eac6f51a67fb587ca55518a9f4fb849
MD5 947659712a834a5436f1395f4872e1ae
BLAKE2b-256 7806ceec06a2d7e661a00d90018513667047766020d883ce28fcc28019ce183b

See more details on using hashes here.

File details

Details for the file mkdocs_glossary-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for mkdocs_glossary-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9844feb23daf10f6b9185012f0ad664ad4164a1d669827889a30ffcabdce6102
MD5 60854abf9110f1e4751d15ac91942505
BLAKE2b-256 b336777bae872f10e9676bc04f81ce44ba721a4c41be2b77a966931bd3c7c844

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page