ps2-controller / react-chess-analysis-board

React component for a fully featured, stylable chess analysis board.
GNU General Public License v3.0
11 stars 4 forks source link

How to show PGN commentary and sidelines #8

Open webcrawlersites opened 7 months ago

webcrawlersites commented 7 months ago

This npm package works well, but how can I configure it to show the commentary in the PGN code as well as sidelines in the PGN code?

ps2-controller commented 7 months ago

Hi @webcrawlersites -- thanks for asking! I pushed an update to the ReadMe to make it clear that this library is unfinished, and not currently actively maintained.

Currently, I don't have support for showing comments in the Move Tree. However, feel free to fork the code - the PGN is loaded from the AnalysisBoard.

I could be mistaken, but I don't think sideline support in the MoveText is part of the pgn specification. As of now, this library doesn't have RAV support for pgn export purposes.

From the spec:

8.2.5: Movetext RAV (Recursive Annotation Variation)

An RAV (Recursive Annotation Variation) is a sequence of movetext containing
one or more moves enclosed in parentheses.  An RAV is used to represent an
alternative variation.  The alternate move sequence given by an RAV is one that
may be legally played by first unplaying the move that appears immediately
prior to the RAV.  Because the RAV is a recursive construct, it may be nested.

*** The specification for import/export representation of RAV elements needs
further development.