2020-09-19 15:34:40 +03:00
|
|
|
---
|
|
|
|
template: overrides/main.html
|
2021-12-16 19:08:57 +03:00
|
|
|
icon: material/image-size-select-small
|
2020-09-19 15:34:40 +03:00
|
|
|
---
|
|
|
|
|
|
|
|
# Abbreviations
|
|
|
|
|
2021-10-10 13:19:14 +03:00
|
|
|
Technical documentation often incurs the usage of many acronyms, which may
|
2020-09-19 15:34:40 +03:00
|
|
|
need additional explanation, especially for new user of your project. For these
|
|
|
|
matters, Material for MkDocs uses a combination of Markdown extensions to
|
|
|
|
enable site-wide glossaries.
|
|
|
|
|
|
|
|
## Configuration
|
|
|
|
|
2021-10-05 00:36:31 +03:00
|
|
|
This configuration enables abbreviations and allows to build a simple
|
|
|
|
project-wide glossary, sourcing definitions from a central location. Add the
|
2021-10-03 19:02:59 +03:00
|
|
|
following line to `mkdocs.yml`:
|
2020-09-19 15:34:40 +03:00
|
|
|
|
|
|
|
``` yaml
|
|
|
|
markdown_extensions:
|
|
|
|
- abbr
|
2021-10-03 19:02:59 +03:00
|
|
|
- pymdownx.snippets
|
2020-09-19 15:34:40 +03:00
|
|
|
```
|
|
|
|
|
2021-10-03 19:02:59 +03:00
|
|
|
See additional configuration options:
|
2020-09-19 15:34:40 +03:00
|
|
|
|
2021-10-03 19:02:59 +03:00
|
|
|
- [Abbreviations]
|
|
|
|
- [Snippets]
|
2020-09-19 15:34:40 +03:00
|
|
|
|
2021-10-03 19:02:59 +03:00
|
|
|
[Abbreviations]: ../setup/extensions/python-markdown.md#abbreviations
|
|
|
|
[Snippets]: ../setup/extensions/python-markdown-extensions.md#snippets
|
2020-09-19 15:34:40 +03:00
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
### Adding abbreviations
|
|
|
|
|
2021-10-03 19:02:59 +03:00
|
|
|
Abbreviations can be defined by using a special syntax similar to URLs and
|
|
|
|
[footnotes], starting with a `*` and immediately followed by the term or
|
2022-01-10 16:31:58 +03:00
|
|
|
acronym to be associated in square brackets:
|
2020-09-19 15:34:40 +03:00
|
|
|
|
2022-01-10 16:31:58 +03:00
|
|
|
``` markdown title="Text with abbreviations"
|
2020-09-19 15:34:40 +03:00
|
|
|
The HTML specification is maintained by the W3C.
|
|
|
|
|
|
|
|
*[HTML]: Hyper Text Markup Language
|
2020-09-19 17:19:18 +03:00
|
|
|
*[W3C]: World Wide Web Consortium
|
2020-09-19 15:34:40 +03:00
|
|
|
```
|
|
|
|
|
2022-01-10 16:31:58 +03:00
|
|
|
<div class="result" markdown>
|
2020-09-19 15:34:40 +03:00
|
|
|
|
|
|
|
The HTML specification is maintained by the W3C.
|
|
|
|
|
|
|
|
*[HTML]: Hyper Text Markup Language
|
2020-09-19 17:19:18 +03:00
|
|
|
*[W3C]: World Wide Web Consortium
|
2020-09-19 15:34:40 +03:00
|
|
|
|
2022-01-10 16:31:58 +03:00
|
|
|
</div>
|
|
|
|
|
2021-10-03 19:02:59 +03:00
|
|
|
[footnotes]: footnotes.md
|
2020-09-19 15:34:40 +03:00
|
|
|
|
|
|
|
### Adding a glossary
|
|
|
|
|
2021-10-05 00:36:31 +03:00
|
|
|
The [Snippets] extension can be used to implement a simple glossary by moving
|
|
|
|
all abbreviations in a dedicated file[^1], and embedding it with the
|
2022-01-10 16:31:58 +03:00
|
|
|
[`--8<--` notation][Snippets notation] at the end of each document:
|
2021-10-03 19:02:59 +03:00
|
|
|
|
|
|
|
[^1]:
|
|
|
|
It's highly recommended to put the Markdown file containing the
|
|
|
|
abbreviations outside of the `docs` folder (here, a folder with the name
|
|
|
|
`includes` is used), as MkDocs might otherwise complain about an
|
|
|
|
unreferenced file.
|
2020-09-19 15:34:40 +03:00
|
|
|
|
2021-10-10 13:19:14 +03:00
|
|
|
=== ":octicons-file-code-16: docs/example.md"
|
2020-09-19 15:34:40 +03:00
|
|
|
|
|
|
|
```` markdown
|
|
|
|
The HTML specification is maintained by the W3C.
|
2021-10-05 00:36:31 +03:00
|
|
|
|
2021-01-12 19:14:41 +03:00
|
|
|
--8<-- "includes/abbreviations.md"
|
2020-09-19 15:34:40 +03:00
|
|
|
````
|
|
|
|
|
2021-10-03 19:02:59 +03:00
|
|
|
=== ":octicons-file-code-16: includes/abbreviations.md"
|
2020-09-19 15:34:40 +03:00
|
|
|
|
|
|
|
```` markdown
|
|
|
|
*[HTML]: Hyper Text Markup Language
|
2020-09-19 17:19:18 +03:00
|
|
|
*[W3C]: World Wide Web Consortium
|
2020-09-19 15:34:40 +03:00
|
|
|
````
|
|
|
|
|
2021-10-03 19:02:59 +03:00
|
|
|
[Snippets notation]: https://facelessuser.github.io/pymdown-extensions/extensions/snippets/#snippets-notation
|