2020-07-27 12:05:07 +02:00
|
|
|
---
|
|
|
|
template: overrides/main.html
|
2021-12-16 17:08:57 +01:00
|
|
|
icon: material/format-font
|
2020-07-27 12:05:07 +02:00
|
|
|
---
|
|
|
|
|
|
|
|
# Formatting
|
|
|
|
|
|
|
|
Material for MkDocs provides support for several HTML elements that can be used
|
|
|
|
to highlight sections of a document or apply specific formatting. Additionally,
|
2021-10-04 23:36:31 +02:00
|
|
|
[Critic Markup] is supported, adding the ability to display suggested changes
|
2020-07-27 12:05:07 +02:00
|
|
|
for a document.
|
|
|
|
|
2021-10-04 23:36:31 +02:00
|
|
|
[Critic Markup]: https://github.com/CriticMarkup/CriticMarkup-toolkit
|
2020-07-27 12:05:07 +02:00
|
|
|
|
|
|
|
## Configuration
|
|
|
|
|
2021-10-10 12:19:14 +02:00
|
|
|
This configuration enables support for keyboard keys, tracking changes in
|
|
|
|
documents, defining sub- and superscript and highlighting text. Add the
|
2021-10-04 23:36:31 +02:00
|
|
|
following lines to `mkdocs.yml`:
|
2020-07-27 12:05:07 +02:00
|
|
|
|
|
|
|
``` yaml
|
|
|
|
markdown_extensions:
|
|
|
|
- pymdownx.critic
|
|
|
|
- pymdownx.caret
|
2021-10-04 23:36:31 +02:00
|
|
|
- pymdownx.keys
|
2020-07-27 12:05:07 +02:00
|
|
|
- pymdownx.mark
|
|
|
|
- pymdownx.tilde
|
|
|
|
```
|
|
|
|
|
2021-10-10 12:19:14 +02:00
|
|
|
See additional configuration options:
|
|
|
|
|
2021-10-04 23:36:31 +02:00
|
|
|
- [Critic]
|
|
|
|
- [Caret, Mark & Tilde]
|
|
|
|
- [Keys]
|
2021-10-03 18:02:59 +02:00
|
|
|
|
2021-10-04 23:36:31 +02:00
|
|
|
[Critic]: ../setup/extensions/python-markdown-extensions.md#critic
|
|
|
|
[Caret, Mark & Tilde]: ../setup/extensions/python-markdown-extensions.md#caret-mark-tilde
|
|
|
|
[Keys]: ../setup/extensions/python-markdown-extensions.md#keys
|
2020-07-27 12:05:07 +02:00
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
### Highlighting changes
|
|
|
|
|
2021-10-04 23:36:31 +02:00
|
|
|
When [Critic] is enabled, [Critic Markup] can be used, which adds the ability to
|
2022-01-10 14:31:58 +01:00
|
|
|
highlight suggested changes, as well as add inline comments to a document:
|
2020-07-27 12:05:07 +02:00
|
|
|
|
2022-01-10 14:31:58 +01:00
|
|
|
``` title="Text with suggested changes"
|
2020-07-27 12:05:07 +02:00
|
|
|
Text can be {--deleted--} and replacement text {++added++}. This can also be
|
|
|
|
combined into {~~one~>a single~~} operation. {==Highlighting==} is also
|
|
|
|
possible {>>and comments can be added inline<<}.
|
|
|
|
|
|
|
|
{==
|
|
|
|
|
2021-10-04 23:36:31 +02:00
|
|
|
Formatting can also be applied to blocks by putting the opening and closing
|
2020-07-27 12:05:07 +02:00
|
|
|
tags on separate lines and adding new lines between the tags and the content.
|
|
|
|
|
|
|
|
==}
|
2021-08-07 11:10:15 +02:00
|
|
|
```
|
|
|
|
|
2022-01-10 14:31:58 +01:00
|
|
|
<div class="result" markdown>
|
2021-08-07 11:10:15 +02:00
|
|
|
|
|
|
|
Text can be <del class="critic">deleted</del> and replacement text
|
|
|
|
<ins class="critic">added</ins>. This can also be combined into
|
|
|
|
<del class="critic">one</del><ins class="critic">a single</ins> operation.
|
|
|
|
<mark class="critic">Highlighting</mark> is also possible
|
|
|
|
<span class="critic comment">and comments can be added inline</span>.
|
|
|
|
|
|
|
|
<div>
|
|
|
|
<mark class="critic block">
|
|
|
|
<p>
|
2021-10-04 23:36:31 +02:00
|
|
|
Formatting can also be applied to blocks by putting the opening and
|
2021-08-07 11:10:15 +02:00
|
|
|
closing tags on separate lines and adding new lines between the tags and
|
|
|
|
the content.
|
|
|
|
</p>
|
|
|
|
</mark>
|
|
|
|
</div>
|
2020-07-27 12:05:07 +02:00
|
|
|
|
2022-01-10 14:31:58 +01:00
|
|
|
</div>
|
|
|
|
|
2020-07-27 12:05:07 +02:00
|
|
|
### Highlighting text
|
|
|
|
|
2021-10-04 23:36:31 +02:00
|
|
|
When [Caret, Mark & Tilde] are enabled, text can be highlighted with a simple
|
2021-10-10 12:19:14 +02:00
|
|
|
syntax, which is more convenient that directly using the corresponding
|
2022-01-10 14:31:58 +01:00
|
|
|
[`mark`][mark], [`ins`][ins] and [`del`][del] HTML tags:
|
2020-07-27 12:05:07 +02:00
|
|
|
|
2022-01-10 14:31:58 +01:00
|
|
|
``` title="Text with highlighting"
|
2020-11-15 22:25:11 +01:00
|
|
|
- ==This was marked==
|
|
|
|
- ^^This was inserted^^
|
|
|
|
- ~~This was deleted~~
|
2020-07-27 12:05:07 +02:00
|
|
|
```
|
|
|
|
|
2022-01-10 14:31:58 +01:00
|
|
|
<div class="result" markdown>
|
2020-07-27 12:05:07 +02:00
|
|
|
|
2020-11-15 22:25:11 +01:00
|
|
|
- ==This was marked==
|
|
|
|
- ^^This was inserted^^
|
|
|
|
- ~~This was deleted~~
|
2020-07-27 12:05:07 +02:00
|
|
|
|
2022-01-10 14:31:58 +01:00
|
|
|
</div>
|
|
|
|
|
2021-10-10 12:19:14 +02:00
|
|
|
[mark]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/mark
|
|
|
|
[ins]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/ins
|
|
|
|
[del]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/del
|
|
|
|
|
2020-07-27 12:05:07 +02:00
|
|
|
### Sub- and superscripts
|
|
|
|
|
2021-10-04 23:36:31 +02:00
|
|
|
When [Caret & Tilde][Caret, Mark & Tilde] are enabled, text can be sub- and
|
2022-07-02 09:19:54 +02:00
|
|
|
superscripted with a simple syntax, which is more convenient than directly
|
2022-01-10 14:31:58 +01:00
|
|
|
using the corresponding [`sub`][sub] and [`sup`][sup] HTML tags:
|
2020-07-27 12:05:07 +02:00
|
|
|
|
2022-01-10 14:31:58 +01:00
|
|
|
``` markdown title="Text with sub- und superscripts"
|
2022-05-17 07:12:22 +02:00
|
|
|
- H~2~O
|
2020-11-15 22:25:11 +01:00
|
|
|
- A^T^A
|
2020-07-27 12:05:07 +02:00
|
|
|
```
|
|
|
|
|
2022-01-10 14:31:58 +01:00
|
|
|
<div class="result" markdown>
|
2020-07-27 12:05:07 +02:00
|
|
|
|
2022-05-17 07:12:22 +02:00
|
|
|
- H~2~O
|
2020-11-15 22:25:11 +01:00
|
|
|
- A^T^A
|
2020-07-27 12:05:07 +02:00
|
|
|
|
2022-01-10 14:31:58 +01:00
|
|
|
</div>
|
|
|
|
|
2021-10-10 12:19:14 +02:00
|
|
|
[sub]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/sub
|
|
|
|
[sup]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/sup
|
|
|
|
|
2021-10-04 23:36:31 +02:00
|
|
|
### Adding keyboard keys
|
|
|
|
|
|
|
|
When [Keys] is enabled, keyboard keys can be rendered with a simple syntax.
|
|
|
|
Consult the [Python Markdown Extensions] documentation to learn about all
|
2022-01-10 14:31:58 +01:00
|
|
|
available shortcodes:
|
2021-10-04 23:36:31 +02:00
|
|
|
|
2022-01-10 14:31:58 +01:00
|
|
|
``` markdown title="Keyboard keys"
|
2021-10-04 23:36:31 +02:00
|
|
|
++ctrl+alt+del++
|
|
|
|
```
|
|
|
|
|
2022-01-10 14:31:58 +01:00
|
|
|
<div class="result" markdown>
|
2021-10-04 23:36:31 +02:00
|
|
|
|
|
|
|
++ctrl+alt+del++
|
|
|
|
|
2022-01-10 14:31:58 +01:00
|
|
|
</div>
|
|
|
|
|
2021-10-10 12:19:14 +02:00
|
|
|
[Python Markdown Extensions]: https://facelessuser.github.io/pymdown-extensions/extensions/keys/#extendingmodifying-key-map-index
|