I've had to constantly update my fork of KaTeX to keep up with master, so you can look there to get an idea of what is involved. cursor class, as well as appropriate applications of \xmlClass and rule-I haven't explored this.) (Could possibly be bodged with special CSS rules for a. This, in turn, is used to convert DOM events (mouse movement and clicks) into the appropriate edits on the XML source.Ī \cursor element to create a cursor line that has zero effective width and that doesn't affect the spacing of elements around it. This is used to add classes to all rendered HTML elements that correspond with their positions in the source XML structure. Just popping in to say, in case it is still useful to know: The modifications to KaTeX required to support the editing in guppy are exactly:Īn \xmlClass element to add classes to the generated HTML. So, what am I missing and is there some better way than modifying each method of build*.js? It doesn't look too hard to me, but still. I think this would be inconvenient and there must be only one attribute in root node of every rendered ParseNode. I've tried to pass attributes through buildHTML to makeSpan, but in the result there was a lot of duplicating attributes in the DOM (like katex-id="1" presented multiple times in fraction markup). In my earlier experiment I've tried to avoid changes in build*.js when possible. buildMathML methods should set attributes on MathNodes constructed in mathMLTree.js. In particular, buildHTML methods should set attributes field to spans built by buildCommon.js. Modify every method in buildHTML.js and buildMathML.js to include attributes from parsed nodes.
It should be an object which stores attribute names and values (primitives only). Add field attributes to a tree node which will be evaluated in #376.
WYSIWYG LATEX EDITOR WINDOWS HOW TO
So, naive idea how to implement this issue:
I see there is existing support for arbitrary attributes in constructed HTML and MathML nodes. We could add an id prop to each node in the parseTree and matching katex-id properties to corresponding DOM has been experimenting with adding katex-ids in master.spontaliku-softaria:math-input. In order to facilitate using the mouse to position the cursor and make selections we'll want someway to link nodes in the DOM with nodes in the parse tree.
I think the biggest challenge will be generating new nodes in the format expected by buildTree. The parse tree doesn't support anyway to navigate to sibling nodes or to navigate to a parent node, but it could be made to do so. If we go with the parse tree approach we'd want to be able to navigate through the tree.