KaTeX parse error

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

Could you post the Markdown source of the note?

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)

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

$ 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: !@#\$%^&*()

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

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.

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.

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?

1 Like

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.

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.

1 Like

laurent Then How can we disable this.

Recently pulled over to Joplin from Evernote. Very happy I did and I can appreciate all the work that has gone into the project.

This KaTeX formatting though is very problematic. Very many of my notes in Evernote used short Hash and/or Dollar sign imbedded codes which I need to be able to read properly, and also use.

Those codes often get pulled out (to my eyes anyway) and I get

KaTeX parse error: Expected 'EOF', (along with the truncated text).

It seemed there was some setting among the Markdown settings in Joplin that could turn that behavior off but I am not finding those it just now.
I have very many notes which will require adding "quotation" type markers to make this clear, and to do so one at a time.

Any thoughts on which Markdown settings or plugins which can be added to Joplin to rectify. (I may have added a plugin to one computer and not another come to think of it, but it could also have been a checkbox)

Thanks' in advance for any reply.

I did just find this note one the subject.
github.../laurent22/joplin/issues/8199

Referring as it were to "filemaker code" in Joplin. Filemaker starts many code references with $ so yes. Agreed

I will look for the "math's expression" and try to disable. Would rather not but only 2 sides of a coin it seems.

Given that KaTeX seems to always error with the same message, would it not be possible to keep a copy of the original, see what KaTeX makes a chunk of text and then if it contains "KaTeX paree error" at the start, just jump out of converting that section and put the original back in?

(Not super familiar with the flow of converting markdown to rendered html so forgive me if this is impossible)