Libbum / oration

A Rocket/Elm self hosted commenting system for static sites
MIT License
22 stars 5 forks source link

Implement Katex #60

Closed Libbum closed 6 years ago

Libbum commented 6 years ago

This is a half assed attempt at #58, but it's failing pretty hard. Splitting up the system into human and display as in cb39c67 is annoying and overkill, but just printing values identified as in 0595fed doesn't render. In fact, I can only seem to get the elm-katex demo working, which has precompiled text. That's not something that is ever going to be useful, so I need to look at alternate methods.

Libbum commented 6 years ago

Ignoring elm-katex all together is probably the way to go. if we add katex to index.html, including the auto render we can get things working by using

setTimeout(function () {                                                                        
     renderMathInElement(elmDiv,                                                                 
         {                                                                                       
               delimiters: [                                                                     
                   {left: "$$", right: "$$", display: true},                                     
                   {left: "$", right: "$", display: false},                                      
               ]                                                                                 
           }                                                                                     
     );                                                                                          
 }, 100);

(note the 100 is important, anything earlier and we fail to render).

What this doesn't do is update dynamically. I think we might just want to talk to katex directly through ports and be done with it.

Libbum commented 6 years ago

Closing in favour of #71.