Docs / Course authoring
Course pages - the diagram tag
The ::diagram tag shows a chessboard in a course page, either static or with a navigable line of moves. Clicking it opens the line in the full analysis board.
::diagram{id="d1a2b3c4" startFen="rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1" moves="1. e4 e5 2. Nf3 Nc6" orientation="white" ply="0" label="Italian opening"} Attributes
| Attribute | Default | Description |
|---|---|---|
id | none (recommended) | Diagram identifier. It is the anchor #res-<id> and lets the AI Coach display exactly this diagram. The visual editor generates one (the letter d followed by 8 characters). |
startFen | standard starting position | FEN of the starting position. If present it is always validated when the page is saved, even without moves. See FEN formats and validation. |
moves | none (static diagram) | A line of moves in English SAN (Nf3, Bb5, O-O). Move numbers are optional. May contain PGN comments with annotations. |
orientation | white | white or black (the side shown at the bottom). Any other value means white. |
ply | 0 | Half-move displayed when the diagram opens. |
label | none | Label used by the Coach. It is not displayed under the board. |
label.<code> | none | Label in another language of a multilingual course, for example label.en="Opening" (<code>: fr, en, es, ru, he). Without it, readers in that language get label. |
Annotations: arrows and colored squares
Inside a PGN comment of moves:
[%cal Ge2e4,Rf1a6]draws arrows (color, from-square, to-square);[%csl Ge2,Rd4]highlights squares (color, square);- colors:
Ggreen,Rred,Yyellow,Bblue.
::diagram{id="d7" moves="1. d4 { [%cal Gd4e5][%csl Re5] } d5 2. c4"} Translated comments (multilingual courses)
In a multilingual course, a diagram is never duplicated per language: its texts are translated in place.
- Move comment:
[%lang <code> "…"]inside the comment gives the text in that language. The free text of the comment is the base language; arrows and squares are shared. - Label:
label.<code>="…"(see the table above).
::diagram{id="d8" moves="1. e4 { Le pion du roi [%lang en "King pawn"] [%lang he "פיון המלך"] [%cal Ge2e4] } e5" label="Ouverture" label.en="Opening"} Escaping, in the page source (the command sits inside the moves="…" attribute):
| In the translated text | Written in the page source |
|---|---|
| the quotes around the text | \" (as in the example) |
a quote " | \\\" |
a backslash \ | \\\\ |
a brace { or } (forbidden in a PGN comment) | \\u007b or \\u007d, shown as parentheses |
The diagram editor writes all of this for you: choose the language in its “Language of the label and comment” selector.
Readers see the comment and label of their language, or those of the base language when a translation is missing.
Validation when the page is saved
- The
movesline is replayed fromstartFen. An illegal or unknown move makes saving and publishing fail with::diagram ligne illégale(the message is currently in French). plymust be an integer between 0 and the number of half-moves inmoves(comments and move numbers are not counted). A static diagram withoutmovestherefore needsply="0".- A non-integer
plyis refused. - Variations in parentheses and NAGs (
$1) are not accepted insidemoves: use a single main line. - Replay is limited to 400 half-moves.
Writing tips
- To show the final position of a line, set
plyto the number of half-moves of the line. - To illustrate a position without moves, use
startFenalone withply="0". - Never invent a FEN: derive it from moves or validate it first.