chrislicodes / obsidian-chess-study

A chess study helper and PGN viewer/editor for Obsidian.
GNU General Public License v3.0
36 stars 4 forks source link

Error in parsing PGN #2

Closed kevinpolisano closed 8 months ago

kevinpolisano commented 1 year ago

Hello,

Thank you for this great plugin!

I tried to import this PGN (which works on lichess):

[FEN "r1bqkbnr/1pp2ppp/p1p5/4p3/3PP3/5N2/PPP2PPP/RNBQK2R b KQkq - 0 5"]
5... Bg4

and I get this error:

plugin:chess-study:45863 Error: Invalid move in PGN: [FEN
    at Chess.loadPgn (plugin:chess-study:25237:17)
    at PgnModal.onSubmit (plugin:chess-study:45838:21)
    at eval (plugin:chess-study:45769:14)
    at HTMLButtonElement.<anonymous> (app.js:1:820048)

Edit: I have noticed that starting from a given FEN is in your TODO list, sorry!

Best regards

chrislicodes commented 1 year ago

Hey,

interesting - which tool is exporting PGNs like this? Is it also on LiChess? PGNs are parsed with https://github.com/jhlywa/chess.js - so we could sanitise the string additionally, but for now it would be best to remove the FEN string.

kevinpolisano commented 1 year ago

Hey,

It is the common notation for games/problems starting at a given position. Indeed you can load or export that on Lichess.

This tool also takes advantage to that notation to produce Anki flashcard: https://github.com/TowelSniffer/Anki-Chess-2.0

chrislicodes commented 8 months ago

Hey Kevin, there will be a new version soon which will support FEN starting positions - there is no plan to support the string you posted right now but feel free to submit a PR! 🤖

kevinpolisano commented 8 months ago

Hey Chris!

Can you explain how to declare a FEN starting position? :)