As an enthusiast chess player, I like to manage my games and my opening repertoire as a set of PGN files stored in a Git repository (PGN is a text file format for recording chess games). So I wanted a way to pretty-print PGN files using a CLI and integrating in my editor.
Today, it looks like most people use GUI-based software. So I decided to create a Prettier plugin that formats PGN files. Prettier is a well-known pretty-printer in the Node.js ecosystem, used to ensure consistent source code formatting in software projects. One upside of implementing this PGN formatter as a Prettier plugin is that it benefits from its editor integration.
The plugin is currently near complete, even if the project is still at an early stage. It's usable, even if there might be some bugs.
Hope you find this useful. Comments and ideas are welcome. Have a nice weekend.
Thank you!
By the way, something I've considered but not implemented yet are options to tweak the formatting (for instance, whether to indent or inline comments / variations). The Prettier approach is to be opinionated, but some language-specific options may be useful.
For that purpose, you can use Latex (yes, I know, not everybody's cup of tea)
I really like the JS preview/rendering plugins for fenced code blocks in Markdown. For example Mermaid, which is supported by many Markdown renderers or IDEs. [1]
It would be fun to have something like this for chess notation, that interactively renders the last position with forward and back buttons.
Static PDFs are mostly a thing of the past.
[1]: https://github.blog/developer-skills/github/include-diagrams...
For personal notes, I would also consider embedding PGN into Markdown. Sadly, PGN rendering in Markdown isn't supported yet, as far as I know (something like Mermaid would be awesome).
https://chromewebstore.google.com/detail/lichess-print-frien...
It pretty-prints a PDF directly from lichess.