feat: add public Pgn_to_tex entry point

Move parsing and rendering internals into the private
pgn_to_tex_internal library and rename pgn2tex to converter. Expose only
Pgn_to_tex with default to_tex arguments, abstract diagram_data,
empty_diagrams, and parse_diagrams_json. Update tests, JS bridge, and
README to the new names.
This commit is contained in:
2026-10-23 16:38:24 +02:00
committed by owenrees
parent 8df30f1746
commit 548f98f303
22 changed files with 111 additions and 48 deletions
+3 -3
View File
@@ -9,7 +9,7 @@
## Usage
```ocaml
open Pgn_logic
open Pgn_to_tex
let diagrams_json_stringified =
{| [
@@ -18,9 +18,9 @@ let diagrams_json_stringified =
{"ply":4,"fen":"rnbqkbnr/ppp1pppp/3p4/8/3PP3/8/PPP2PPP/RNBQKBNR b KQkq - 0 3","path":["d4","d5","e4","d6"]}
] |}
let diagram_data = Pgn2tex.parse_diagrams_json diagrams_json_stringified
let diagram_data = parse_diagrams_json diagrams_json_stringified
let game_tex = Pgn2tex.to_tex pgn ~diagram_data ~clock:false
let game_tex = to_tex ~diagram_data ~clock:false pgn
```
This will return a LaTex markdown representation of the PGN file along with chess board diagrams at the specified ply. Clock times can be rendered for both sides if you pass `~clock:true` to the `to_tex` function.