PyMdown Mahjong¶
Purpose¶
PyMdown Mahjong is an extension for Python Markdown that aids writing Mahjong content. Designed with MkDocs and Zensical in mind, the extension offers:
- Inline rendering of individual Mahjong tiles.
- Complete Mahjong hand rendering, supporting: pon/chi/kan, and dora information.
Installation¶
Copy mahjong.css to stylesheets/.
Configuration¶
| Key | Type | Options | Default | Description |
|---|---|---|---|---|
| theme | str | auto light dark |
auto |
|
| closed_kan_style | str | outer inner |
outer |
outer: back, front, front, back inner: front, back, back, front |
MPSZ Notation¶
The extension uses standard MPSZ notation for tiles.
| Notation | Tile | Tile (Emoji) |
|---|---|---|
1m, 2m, ... |
Manzu | |
1p, 2p, ... |
Pinzu | |
1s, 2s, ... |
Souzu | |
0m 0p 0s |
Akadora | |
1z |
East / Ton | |
2z |
South / Nan | |
3z |
West / Sha | |
4z |
North / Pei | |
5z |
White Dragon / Haku | |
6z |
Green Dragon / Hatsu | |
7z |
Red Dragon / Chun |
Hand Syntax¶
Hands are written in a fenced codeblock, with additional YAML-like options for dora, uradora, and title.
Syntax for Melds¶
Parenthesis () for open melds. < ^ > to indicate direction of meld.
(123m<)- Chi from kamicha(111m<)- Pon from kamicha(111p^)- Pon from toimen(999s>)- Pon from shimocha
Brackets [] for closed kan.
[1111z]- Closed kan
Additional sign + to indicate added kan.
(666+6z^)- Added Kan