Blog »

New OborWiki feature: chess notation & display

December 31, 2017, at 05:03 PM by Obormot in Features, Updates (0 comments)

The Chess Markup recipe is now installed on OborWiki (off by default; you can enable it via the Configurator). It lets you embed chessboards, and chess game notation, in a wikipage.

The following is taken from the Chess Markup recipe info page.


First, the (:chessboard:) markup can be used to display a simple chessboard:

(:chessboard align=center:)
rnbqkbnr
pppppppp
........
........
........
........
PPPPPPPP
RNBQKBNR

There are options available (described below) for changing the size and color of the resulting chessboard image.

Of course, displaying a chessboard in its starting position isn't all that useful by itself, so this recipe also recognizes Portable Game Notation as wiki markup that internally modifies the chessboard. Thus, an author can write something like

    1. e4 c5                            Sicilian opening
    2. Nf3 d6 3. d4 cxd4 4. Nxd4 Nf6
    5. Nc3 g6                           Dragon variation

and PmWiki treats each of the above PGN entries as moves in a virtual game. The (:chessboard:) markup then displays the state of the current game:

(:chessboard align=center:)
rnbqkb.r
pp..pp.p
...p.np.
........
...NP...
..N.....
PPP..PPP
R.BQKB.R

Following multiple analysis lines

The PGN markup can also be used to investigate alternate lines of play. For example, starting with the Dragon variation listed above, we can write

The move 2...e6 leads to more defensive variations of the Sicilian opening. The Taimanov variation goes 2...e6 3.d4 cxd4 4.Nxd4 Nc6 which leads to:

(:chessboard align=center:)
r.bqkbnr
pp.p.ppp
..n.p...
........
...NP...
........
PPP..PPP
RNBQKB.R

Notice how the 2...e6 markup undid the previous moves of the Dragon variation and started a new line of play leading from White's 2.Nf3 move.

Of course, this means that starting from a completely new board position is as simple as writing a new first move:

    1. d4

It's also possible to display a chessboard in a specific position using Forsyth-Edwards Notation. For example, to display a chessboard after white's third move in the classic Ruy Lopez:

(:chessboard r1bqkbnr/pppp1ppp/2n5/1B2p3/4P3/5N2/PPPP1PPP/RNBQK2R align=center:)
r.bqkbnr
pppp.ppp
..n.....
.B..p...
....P...
.....N..
PPPP.PPP
RNBQK..R

The {FEN} markup can be used to get the current game stage as a FEN record.


See the Chess Markup recipe info page for more information.

Leave a reply
Your name (required):

Your comment (required):


Enter value: Captcha