KaTeX
KaTeX copied to clipboard
\htmlData corrupts values with leading/trailing spaces
Please review this line of code:
https://github.com/KaTeX/KaTeX/commit/e5333ad04d77b0d6affa277c98b1ac228e33d15d#diff-049c9fc9dd24dc9042e1a09353e50a767674dc5444423cbc1a824abf083a355bR60
attributes["data-" + keyVal[0].trim()] = keyVal[1].trim();
The second trim() should be removed, so that \htmlData{key= value } honors the spaces.
I am experimenting with macros for \label and \eqref which use \htmlData{katex-label=#1}. Spaces are syntactically valid in latex labels. So now I've got a mostly working implementation, but it breaks on this edge case, where the user chooses a label with spaces.