Hello,
Take the following mld file:
{@ocaml[
type s = { x : int list }
]}
{@ocaml[
# let x = { x = [1; 2; 3] };;
]}
Applying ocaml-mdx modifies the second block into the following as expected
{@ocaml[
# let x = { x = [1; 2; 3] };;
val x : s = {x = [1; 2; 3]}
]}
The issue comes when one applies ocaml-mdx again, which yields:
{@ocaml[
# let x = { x = [1; 2; 3] };;
-val x : s = {x = [1; 2; 3]}
+val x : s = {x = [1; 2; 3]}]}
]}
i.e. mdx keeps adding ]} closing tags after the struct, because it ends with ]}. You can run dune test --auto-promote as many time as you want and it will keep adding closing tags. Here after a few iterations:
{@ocaml[
# let x = { x = [1; 2; 3] };;
-val x : s = {x = [1; 2; 3]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}
+val x : s = {x = [1; 2; 3]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}
]}
Unfortunately this is actively in the way of us using mdx, because there is no workaround that I can see. I'd welcome any pointer towards how to fix that issue and I'm happy to draft a PR