advait / obsidian-chessboard

Plugin to render chessboards in Obsidian using chessboardjs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Obsidian Chess Plugin

This plugin adds the capability to visualize Chess FEN positions on a SVG chessboard directly in preview mode.

By design, this plugin is for visualization only. Do not expect interactivity or the possibility to handle entire games in PGN format. This plugin want to render just a SVG image and it is optimized for visualization and HTML/PDF exports.

If you want a more interactive plugin, I recommend Chesser.

How to use it

After you installed the plugin, just write the FEN position representation inside a code block with the chessboard language.

Example

```chessboard
fen: r1bqkbnr/pppp1ppp/2n5/1B2p3/4P3/5N2/PPPP1PPP/RNBQK2R
```

Example

Change Board Orientation

Use the orientation command. It can be white (default) or black.

```chessboard
fen: r1bqkbnr/pppp1ppp/2n5/1B2p3/4P3/5N2/PPPP1PPP/RNBQK2R
orientation: black
```

Annotations (Beta)

You can annotate your schema with arrows and highlights.

```chessboard
fen: r1bqkbnr/pppp1ppp/2n5/1B2p3/4P3/5N2/PPPP1PPP/RNBQK2R
annotations: Af8-b4 Hf8
```

Example Annotations

Syntax

  • A<square>-<square>, draws an arrow from the first square to the second square. E.g., Af8-b4.
  • H<square>, highlight a specific square. E.g., Hf8.

How to compile the plugin

First, install the dependencies with

npm i

Then, you can compile the plugin with:

npm run build

This will create a main.js file in the project root. That is the entry point of the plugin.

Planned Features

  • Chessboard color customization.
  • Chessboard annotation and highlights.

Chess Pieces

The SVG pieces were made by jurgenwesterhof (adapted from work of Cburnett), CC BY-SA 3.0 https://creativecommons.org/licenses/by-sa/3.0, via Wikimedia Commons.

About

Plugin to render chessboards in Obsidian using chessboardjs


Languages

Language:TypeScript 97.7%Language:JavaScript 2.3%