Home / GitHub Page

KaTeX parse error


#1

I’m not sure I’m very much pleased with all notes being KaTeXed. Can this be switched off?


#2

Could you post the Markdown source of the note?


#3

Sure.

http://www.squirrel.nl/pub/xfer/uploads/3C4rwZYpvcF96EWYk1n6lirw.md

html

html<sup>xxx</sup>
html<sub>xxx</sub>
!@#$%^&*()
!@#$%^&*()

id: 162c18c9847b4d60b30477e835b50530
parent_id: 1336ea5127b84a95a78598899142264e
created_time: 2018-11-18T16:16:06.184Z
updated_time: 2018-11-29T12:58:15.952Z
is_conflict: 0
latitude: 0.00000000
longitude: 0.00000000
altitude: 0.0000
author: 
source_url: 
is_todo: 0
todo_due: 0
todo_completed: 0
source: joplin-desktop
source_application: net.cozic.joplin-desktop
application_data: 
order: 0
user_created_time: 2018-11-18T16:16:06.184Z
user_updated_time: 2018-11-29T12:58:15.952Z
encryption_cipher_text: 
encryption_applied: 0
type_: 1

( I was playing with a keyboard attached to the Android)


#4

The string »dollar hatch dollar« (which cannot be typed here) is sufficient to trigger this error.


#5

$ is indeed the marker for Katex although if I remember well there are checks so for example things like prices $3 aren’t detected as Katex. I’ll check but in the meantime it’s always possible to escape markers with \ so for example that should work: !@#\$%^&*()


#6

Note that in Deploy as web app? I needed to escape all dollars from getting garbled results.


#7

Couldn’t you wrap the text in a code block? It’s a bit unfortunate but I can’t think of an easy solution. Some characters are reserved in Markdown and we can’t ignore them in some cases and not in others.


#8

Some characters are reserved in Markdown

Yes. And dollar is not one of them.

So I still would like an option to enable/disable KaTeX parsing both globally and on a per-note base.

Also, AFAIK discourse does not use KaTex, so $$ should be safe here.


#9

I’d rather not have options for this if it can be avoided, for example by better detecting what is Katex code or not.

I couldn’t see the example you mentioned in “Deploy as web app?”, could you post here the code that’s causing problems?

In general, do you have real life examples of code that should not have been detected as Katex?


#10

As per your advice I wrapped the text in a code block, so it is no longer there. But basically I wanted to show a couple of lines from shell commands, e.g.

$ echo Hello World!
$ echo Two commands

When typed as two ordinary text lines (whthout blockquote) it is shown as echo Hello World! echo Two commands.

It depends on your world view whether you consider that ‘real life’. The point remains that $ is not a reserved character in MarkDown.
I do agree, however, that text like this should better be quoted.

I’ll learn to live with it.


#11

I think the $ syntax shouldn’t appear to multiple lines like it does there (only the $$ should) so as a first step I’ll disable this.