Continuing my PR series adding features to the Katex implementation, I added support for equation labelling and referencing (more Mathjax compatibility):
I enabled it in the Discourse code too as seen in the commit. This adds support for \tag, \label, \ref, \eqref so equations can be labeled and referenced (references are clickable too). This is another feature that Katex disables by default. Enabling it brings the Katex implementation in DIscourse more inline with Mathjax. My previous PR added support for persistent macros.
Made another PR, this time to add something I always wanted: proper copy/paste of latex code: highlight rendered latex in a post, paste in editor and get proper latex, see:
@sam The Discourse “quote” functionality is also improved, but has a quirk: while it does insert the proper latex code for the highlighted equation (hence I take the Discourse code relies on clipboard features), it still adds the plain-text version as well and does so twice, which is clearly a bug. I can look into this and try to fix it but I could use a pointer from you for the Discourse code that handles the “Quote” feature for highlighted text to save me some time.
Not sure if it’s related to my fix that @sam pointed out, but I can check. Would you mind providing some Latex code that I can use to try and reproduce? A screen recording of what is happening would be very useful too.