defzone.net@gmail.comLiên hệ
DZ
DefZone.Net

Kien thuc cong nghe & giai tri

Bài viếtĐịa điểmAlbum ảnhGameCửa hàng
  1. Home
  2. Wiki
Template documentation[view] [edit] [history] [purge]
This template uses Lua:
  • Module:Mahjong

This is a template to produce graphical mahjong tiles inline with text. It is intended to simplify making these diagrams considering the somewhat extreme number of images involved, and their less-than-friendly systematic names. If a reader selects some text including some tiles and copies to clipboard, the tiles will be represented with Unicode Mahjong Tiles.

Mahjong has many variants and this template is intended to be agnostic to them. You can specify your desired variant (see table). The tiles do have minor visual differences between variants, and some features are only enabled for certain variants.

Tile illustrations by User:Cangjie6.

Usage

[edit]

This template is to be used inline. The first parameter specifies the variant and the second is the MPSZ notation of the tiles to be displayed.

Supported variants

[edit]
Variant Example hand
hk – Old Hong Kong mahjong (default) {{mahjong|hk|456p 111s 789s 55z 66z-5z}}
⁠🀜🀝🀞🀐🀐🀐🀖🀗🀘🀆🀆🀅🀅 🀆⁠
jp – Japanese mahjong {{mahjong|jp|456p 111s 789s 55z 66z-5z}}
⁠🀜🀝🀞🀐🀐🀐🀖🀗🀘🀆🀆🀅🀅 🀆⁠
us – American mahjong {{mahjong|us|456p 111s 789s 55z 66z-5z}}
⁠🀜🀝🀞🀐🀐🀐🀖🀗🀘🀆🀆🀅🀅 🀆⁠

MPSZ notation

[edit]

In MPSZ, you put a list of numbers of a given suit followed by a letter that indicates which suit they are. These are m for kraks/man, p for dots/pin, and s for bams/sou. z is for unnumbered tiles. Here is an example:

45m 4555899p 88s 12z: ⁠🀊🀋🀜🀝🀝🀝🀠🀡🀡🀓🀗🀀🀁⁠

If you don't want to show them in any sorted order, you don't have to do that. Here is the same example before it is sorted:

5p 4s 5p 8p 1z 5m 5p 4m 8s 9p 4p 9p 1z: ⁠🀝🀓🀝🀠🀀🀋🀝🀊🀗🀡🀜🀡🀀⁠

If you are showing sorted tiles or sets, please group them together (e.g. 456p, not 4p 5p 6p).

The honors are notated as though they were a fourth suit, z, numbered 1 through 7. The winds are 1 to 4 (east, south, west, north) and the dragons are 5 to 7 (white, green, red).

  • 1z: ⁠🀀⁠ east
  • 2z: ⁠🀁⁠ south
  • 3z: ⁠🀂⁠ west
  • 4z: ⁠🀃⁠ north
  • 5z: ⁠🀆⁠ white
  • 6z: ⁠🀅⁠ green
  • 7z: ⁠🀄︎⁠ red

Other tiles are typically not supported in MPSZ. This template has some non-standard extensions to deal with this. Bonus tiles are added under q. The seasons are 1 to 4 and the flowers are 5 to 8.

  • 1q: ⁠🀦⁠ spring
  • 2q: ⁠🀧⁠ summer
  • 3q: ⁠🀨⁠ autumn
  • 4q: ⁠🀩⁠ winter
  • 5q: ⁠🀢⁠ plum blossom
  • 6q: ⁠🀣⁠ orchid
  • 7q: ⁠🀤⁠ chrysanthemum
  • 8q: ⁠🀥⁠ bamboo

Use X in place of a number for stolen kong (555Xp ⁠🀝🀝🀝🀫⁠) or any other situation where you need to show a flipped tile. Visually split off exposed sets, bonuses and the drawn tile from the rest of the hand by separating them with dashes (-) instead of spaces:

9m 67p 9s-456p-222Xp-5555z-8q: ⁠🀏🀞🀟🀘 🀜🀝🀞 🀚🀚🀚🀫 🀆🀆🀆🀆 🀥⁠

Custom extensions

[edit]

Append @ to a number for the corresponding tile to be grayed out. You can use this to highlight an important part of a hand (like the part being discussed) apart from an irrelevant part (1@1@1@2233445@6@m 7@7@z-7@m ⁠🀇🀇🀇🀈🀈🀉🀉🀊🀊🀋🀌🀄︎🀄︎ 🀍⁠). Do not convey information solely through this tinting feature; assume that it will not work on older browsers and screen readers. Alternatively, to show an unspecified tile, use ? instead of a number (⁠🀫⁠).

Japanese mahjong

[edit]

For Japanese mahjong, make sure you are using jp as the first parameter or the tiles won't display correctly. jp will enable the unusual tilted tiles in called groups, and recolor the tiles to Japanese standards.

To show red fives, use zero as the rank (0m 0p 0s ⁠🀋🀝🀔⁠). Unfortunately, there is no indication that they are red if they are copied as text to the clipboard.

For called groups, add an apostrophe (') after the number to turn the tile sideways (7'77z ⁠🀄︎🀄︎🀄︎⁠). For closed kan, use X in place of a number to show a concealed tile (X88Xp ⁠🀫🀠🀠🀫⁠). For added kan, add a quote (") after one number for it to appear as two stacked tiles (11"1m ⁠🀇🀇🀇🀇⁠). Remember to split off calls by separating them with dashes (-) instead of spaces:

679p 5z-222'm-66'6z-777"z: ⁠🀞🀟🀡🀆 🀈🀈🀈 🀅🀅🀅 🀄︎🀄︎🀄︎🀄︎⁠

When using " on a red five, only one of the stacked tiles will be red (this is intentional). Do not use " on flowers or seasons as these tiles cannot form added kans. If you are using @ to gray out a rotated tile, this goes after ' or " (as in 3'@z ⁠🀂⁠).

American mahjong

[edit]

Use the variant us to use American colors for the tiles, and the illustrated dragons ⁠🀅🀄︎⁠.

To show jokers, use J instead of a number. You can put J in any group, regardless of suit (88Js ⁠🀗🀗🀪⁠). If you have a group with only jokers, you do not need to specify a suit (JJJ ⁠🀪🀪🀪⁠).

Big mode

[edit]

Use big=yes for a large, illustrative size. This is for showing what individual tiles look like, or easily readable hands that are the object of discussion. Not for use inline.

{{mahjong|big=yes|19m 19p 19s 1234567z-4z}}

🀇🀏🀙🀡🀐🀘🀀🀁🀂🀃🀆🀅🀄︎ 🀃

If you just show one big tile, that will be handled differently. The tile will be clickable like a normal image, and have an alt text about its appearance instead of type. This behavior is for introducing tiles in articles, like in tables with each type shown.

{{mahjong|big=yes|8p}}

A mahjong tile with eight blue circles in two columns of four.

Parameters

[edit]
1
The variant (one of hk, jp or us). If no valid code is provided, {{{1}}} will instead be used for the MPSZ data (which is {{{2}}} otherwise).
2
The list of tiles to display, in MPSZ format (with some modifications to support versions besides Japanese mahjong).
big
Set to yes to enable big mode, for much larger tiles not intended for inline display.

Complete tile reference

[edit]
Complete tile reference
hk jp us
X
The reverse side of a mahjong tile.
?
A mahjong tile overlaid with a question mark.
1m
A mahjong tile with the traditional Chinese characters 一 (blue) over 萬 (red).
A mahjong tile with the traditional Chinese characters 一 (blue) over 萬 (red).
A mahjong tile with the traditional Chinese characters 一 (blue) over 萬 (red).
2m
A mahjong tile with the traditional Chinese characters 二 (blue) over 萬 (red).
A mahjong tile with the traditional Chinese characters 二 (blue) over 萬 (red).
A mahjong tile with the traditional Chinese characters 二 (blue) over 萬 (red).
3m
A mahjong tile with the traditional Chinese characters 三 (blue) over 萬 (red).
A mahjong tile with the traditional Chinese characters 三 (blue) over 萬 (red).
A mahjong tile with the traditional Chinese characters 三 (blue) over 萬 (red).
4m
A mahjong tile with the traditional Chinese characters 四 (blue) over 萬 (red).
A mahjong tile with the traditional Chinese characters 四 (blue) over 萬 (red).
A mahjong tile with the traditional Chinese characters 四 (blue) over 萬 (red).
5m
A mahjong tile with the traditional Chinese characters 五 (blue) over 萬 (red).
A mahjong tile with the traditional Chinese characters 五 (blue) over 萬 (red).
A mahjong tile with the traditional Chinese characters 五 (blue) over 萬 (red).
6m
A mahjong tile with the traditional Chinese characters 六 (blue) over 萬 (red).
A mahjong tile with the traditional Chinese characters 六 (blue) over 萬 (red).
A mahjong tile with the traditional Chinese characters 六 (blue) over 萬 (red).
7m
A mahjong tile with the traditional Chinese characters 七 (blue) over 萬 (red).
A mahjong tile with the traditional Chinese characters 七 (blue) over 萬 (red).
A mahjong tile with the traditional Chinese characters 七 (blue) over 萬 (red).
8m
A mahjong tile with the traditional Chinese characters 八 (blue) over 萬 (red).
A mahjong tile with the traditional Chinese characters 八 (blue) over 萬 (red).
A mahjong tile with the traditional Chinese characters 八 (blue) over 萬 (red).
9m
A mahjong tile with the traditional Chinese characters 九 (blue) over 萬 (red).
A mahjong tile with the traditional Chinese characters 九 (blue) over 萬 (red).
A mahjong tile with the traditional Chinese characters 九 (blue) over 萬 (red).
1p
A mahjong tile with a large circle, filled with smaller concentric circles of different colors and a floral pattern.
A mahjong tile with a large blue circle, filled with smaller concentric circles and red in the center.
A mahjong tile with a large circle, filled with smaller concentric circles of different colors and a floral pattern.
2p
A mahjong tile with a blue circle positioned above a green circle.
A mahjong tile with two blue circles arranged vertically.
A mahjong tile with a blue circle positioned above a green circle.
3p
A mahjong tile with three circles, in blue, red and green, diagonal from top left to bottom right.
A mahjong tile with three circles, in blue, red and blue, diagonal from top left to bottom right.
A mahjong tile with three circles, in blue, red and green, diagonal from top left to bottom right.
4p
A mahjong tile with four circles in alternating blue and green colors.
A mahjong tile with four blue circles.
A mahjong tile with four circles in alternating blue and green colors.
5p
A mahjong tile with five circles in alternating blue and green colors; the red central circle is surrounded.
A mahjong tile with five circles; the red central circle is surrounded by four blue circles.
A mahjong tile with five circles in alternating blue and green colors; the red central circle is surrounded.
6p
A mahjong tile with six circles in two columns of three. They are red, except for the top row, in green.
A mahjong tile with six circles in two columns of three. They are red, except for the top row, in blue.
A mahjong tile with six circles in two columns of three. They are red, except for the top row, in green.
7p
A mahjong tile with seven circles; a square of four red circles below a diagonal row of three green circles.
A mahjong tile with seven circles; a square of four red circles below a diagonal row of three blue circles.
A mahjong tile with seven circles; a square of four red circles below a diagonal row of three green circles.
8p
A mahjong tile with eight blue circles in two columns of four.
A mahjong tile with eight blue circles in two columns of four.
A mahjong tile with eight blue circles in two columns of four.
9p
A mahjong tile with nine circles in three rows of three. The rows are colored blue, then red, then green.
A mahjong tile with nine circles in three rows of three. The circles are blue, except for the red middle row.
A mahjong tile with nine circles in three rows of three. The rows are colored blue, then red, then green.
1s
A mahjong tile with an abstract line drawing of a small bird perched on a horizontal branch.
A mahjong tile with a blue peacock-like bird. Its green tail feathers, speckled with red, fill the top half of the tile.
A mahjong tile with an abstract line drawing of a small red bird perched on a diagonal branch.
2s
🀑
🀑
🀑
3s
🀒
🀒
🀒
4s
🀓
🀓
🀓
5s
🀔
🀔
🀔
6s
🀕
🀕
🀕
7s
🀖
🀖
🀖
8s
🀗
🀗
🀗
9s
🀘
🀘
🀘
1z
🀀
🀀
🀀
2z
🀁
🀁
🀁
3z
🀂
🀂
🀂
4z
🀃
🀃
🀃
5z
🀆
🀆
🀆
6z
🀅
🀅
🀅
7z
🀄︎
🀄︎
🀄︎
1q
🀦
🀦
🀦
2q
🀧
🀧
🀧
3q
🀨
🀨
🀨
4q
🀩
🀩
🀩
5q
🀢
🀢
🀢
6q
🀣
🀣
🀣
7q
🀤
🀤
🀤
8q
🀥
🀥
🀥
0m —N/a
A mahjong tile with the traditional Chinese characters 五 over 萬 (both red).
—N/a
0p —N/a
A mahjong tile with five red circles. One central circle is surrounded by the other four.
—N/a
0s —N/a
A mahjong tile with vertical red sticks arranged in two columns of two, flanking a fifth stick in the center.
—N/a
J —N/a —N/a
A mahjong tile with a green line drawing of a fish-like creature inside a blue circle, under a red "JOKER" label.

Current issues

[edit]
  • ⁠🀛⁠ and ⁠🀐⁠ do not display correctly when turned sideways
  • The red fives (⁠🀋🀝🀔⁠) are indistinguishable from regular fives (⁠🀋🀝🀔⁠) on screen readers and to some types of colorblindness
  • The US dragons (⁠🀅🀄︎⁠) are indistinguishable to some types of colorblindness
  • The non-standard @ notation looks very confusing and a better way to highlight tiles is needed
The above documentation is transcluded from Template:Mahjong/doc. (edit | history)
Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages.
Add categories to the /doc subpage. Subpages of this template.
DZ
DefZone.Net

Noi chia se kien thuc, huong dan va kham pha cong nghe.

Lien ket nhanh

Trang chủBài viếtWikiCửa hàngLiên hệ

Liên hệ

Email: defzone.net@gmail.com
Điện thoại: +84 762 559 696
Địa chỉ: Thiên Hương, Thủy Nguyên, Hải Phòng

Đăng ký nhận tin

Nhận bài viết và cập nhật mới nhất qua email.

© 2026 DefZone.Net. All rights reserved.
PrivacyTermsSitemap