DCsunset / vuetify-markdown-editor

A Vue.js Component for editing and previewing markdown using Vuetify.js
MIT License
63 stars 17 forks source link

Katex breaks the editor #5

Closed Divepit closed 4 years ago

Divepit commented 4 years ago

Hey I encountered this when I was writing some code blocks in the Editor:

As soon as there are two "$" characters spread somewhere in the text, Katex will go nuts and break the whole editor. As in it will not respond until the site is reloaded. It will throw:

[Vue warn]: Error in getter for watcher "compiled": "ParseError: KaTeX parse error: Expected 'EOF', got '&' at position 112: …sponse</span> =&̲gt;</span> {

I could fix it with a workaround of using the following render config:

renderConfig: {
        katex: {
          // formula delimiters
          delimiters: [
            {
              left: '$$$',
              right: '$$$',
              options: {
                displayMode: true // block
              }
            },
            {
              left: '\\[',
              right: '\\]',
              options: {
                displayMode: true // block
              }
            },
            {
              left: '$$',
              right: '$$',
              options: {
                displayMode: false // inline
              }
            },
            {
              left: '\\(',
              right: '\\)',
              options: {
                displayMode: false // inline
              }
            }
          ]
        },
        mermaid: undefined // The native mermaid config
      }

Which just changes the Katex prefixes so that the single "$" characters are ignored. If I actually try to write any LaTeX, the Editor will instantly break down with various error messages.

DCsunset commented 4 years ago

The markdown engine has been changed in v3.0.0. Now support for $ symbol becomes better. I hope it fixes this problem.