Using Sensei's Library format to prepare Go diagrams


Sensei's Library is a popular collaborative web site about the game of Go. To facilitate discussions of Go board positions, the website defines an easy-to-use markup language and uses a back-end program to generate Go diagrams from text input. This open-source program has been integrated into Go4Go's content management system so all user posts here can also benefit from such nice feature.

Let's start from an example. The following text is magically converted into the image below:

[diagram] $$c Small avalanche joseki $$ -------------- $$ | . . . . . . . $$ | . . . 3 a . . $$ | . 4 2 X O b . $$ | . . X O . . . $$ | . . X O . . . $$ | . . . 1 . . . $$ | . . . . . . . [/diagram]

Small avalanche joseki

First of all, all texts for a diagram have to be enclosed by diagram tags like:
For users coming from other popular Go websites, such as, it is also possible to use [go]......[/go]
The basic grammar can be easily summarised as follows:

  • Each line starts with $$.
  • Go board boundaries are described using -- (two minus signs for each column) and | (for each row).
  • Black stones, white stones, empty points and hoshi (star) points are represented using letter X, letter O, dots (.), and commas (,), respectively.
  • Up to 10 moves may be placed on the board using numbers (0 is interpreted as move 10).
  • Lower-case letters a...z can be used to annotate game positions.

A number of upper-case letters and symbols may be used to generate special effects on the board, as shown below:

[diagram] $$ Board markup $$ . X . B . # . Y . Z . $$ O . W . @ . Q . P . . $$ . , . C . S . T . M . [/diagram]

Board markup

User can optionally set a number of options in the first line to configure the board. Some useful settings are:

  • Set $$W so that white side plays first. Default is $$B but letter B can be omitted.
  • Use $$c to turn on coordinate on the board. If combined with the above option, use something like $$Wc.
  • Use the m option to set the starting move number, e.g. if $$Wm7 is used, then move corresponding to number 1 in the text is displayed as White 7 .
  • After all the keywords, a text description can be provided which will be reproduced as a caption to the generated diagram.

Finally, the generated diagrams are clickable. Once clicked, corresponding SGF files can be donwloaded for offline viewing in Go software.

The short tutorial here should cover most practical situations. For the full description of the input format, see How Diagrams Work.

Tools for diagram generation:



Hi Mace,

I year or so ago I bookmarked this page, very handy: I used it quite often. Apparently something changed recently, now the diagrams don't show. Please, could you correct this? Thank you!

Kind regards,

Fixed. Occasionally these get messed up by a system upgrade.

You mentioned that diagrams can be created directly from "Go4Go's SGF viewer pages". Can you provide a link to those pages? Thank you.

That is when you view games on this website, under the game board, there's a 'Diagram code' link. If you click it, you get a popup window containing the code for the current board position, which you can copy/paste and edit before using in your posts.