sonoisa / XyJax-v3

Xy-pic extension for MathJax version 3
Apache License 2.0
33 stars 3 forks source link

Expose modifier repositories #10

Open ysulyma opened 2 years ago

ysulyma commented 2 years ago

First: amazing project, very excited to see it ported to MathJax 3!

I have an extension for XyJax that adds

In XyJax 2, I did this by adding to xypic.repositories.modifierRepository. This doesn't seem to be exposed in XyJax 3. Please give a way to access the modifierRepository so I can port my extension.

The source code for my extension is https://github.com/ysulyma/rp-xyjax/blob/main/src/index.ts#L222, so you can see what I'm doing. A live example of these extensions is at https://liqvidjs.org/math/?t=3:00.

Additionally, it would be very helpful to be able to use characters other than [A-Za-z] in arrow modifiers. Currently, I have to do a convoluted base52 encoding/decoding in order to include colors or data.

import {tob52, xyEncodeColor} from "rp-xyjax";

String.raw`
\ar@[data${tob52(json)}]
\ar@[color${xyEncodeColor("AF1866")}]
`