扩展markdown功能¶
Warning
这里的语法并不是Markdown通用语法,其它主题或软件可能并不支持,慎用!
content tabs¶
Configuration¶
This configuration enables content tabs, and allows to nest arbitrary content inside content tabs, including code blocks and ... more content tabs! Add the following lines to mkdocs.yml:
markdown_extensions:
- pymdownx.superfences
- pymdownx.tabbed:
alternate_style: true
Usage¶
Grouping code blocks¶
Code blocks are one of the primary targets to be grouped, and can be considered a special case of content tabs, as tabs with a single code block are always rendered without horizontal spacing:
=== "C"
``` c
#include <stdio.h>
int main(void) {
printf("Hello world!\n");
return 0;
}
```
=== "C++"
``` c++
#include <iostream>
int main(void) {
std::cout << "Hello world!" << std::endl;
return 0;
}
```
#include <stdio.h>
int main(void) {
printf("Hello world!\n");
return 0;
}
#include <iostream>
int main(void) {
std::cout << "Hello world!" << std::endl;
return 0;
}
Grouping other content¶
=== "Unordered list"
* Sed sagittis eleifend rutrum
* Donec vitae suscipit est
* Nulla tempor lobortis orci
=== "Ordered list"
1. Sed sagittis eleifend rutrum
2. Donec vitae suscipit est
3. Nulla tempor lobortis orci
- Sed sagittis eleifend rutrum
- Donec vitae suscipit est
- Nulla tempor lobortis orci
- Sed sagittis eleifend rutrum
- Donec vitae suscipit est
- Nulla tempor lobortis orci
Embedded content¶
!!! example
=== "Unordered List"
``` markdown
* Sed sagittis eleifend rutrum
* Donec vitae suscipit est
* Nulla tempor lobortis orci
```
=== "Ordered List"
``` markdown
1. Sed sagittis eleifend rutrum
2. Donec vitae suscipit est
3. Nulla tempor lobortis orci
```
Example
* Sed sagittis eleifend rutrum
* Donec vitae suscipit est
* Nulla tempor lobortis orci
1. Sed sagittis eleifend rutrum
2. Donec vitae suscipit est
3. Nulla tempor lobortis orci
Admonitions¶
Demo¶
mkdocs支持Admonitions,在网页上显示类似警告信息。
Admonition
Action is the antidote to despair.
???+ note "Admonition"
Action is the antidote to despair.
Quote
-
Adding a
+after the???token renders the block expanded -
通过缩进控制Tab和Admonition结构
Supported types¶
Note
Action is the antidote to despair.
Abstract
Action is the antidote to despair.
Info
Action is the antidote to despair.
Tip
Action is the antidote to despair.
Success
Action is the antidote to despair.
Question
Action is the antidote to despair.
Warning
Action is the antidote to despair.
Failure
Action is the antidote to despair.
Danger
Action is the antidote to despair.
Bug
Action is the antidote to despair.
Example
Action is the antidote to despair.
Quote
Action is the antidote to despair.
Created: October 7, 2023