Joplin: TOC links not working when text contains special characters

Created on 31 Oct 2019  路  11Comments  路  Source: laurent22/joplin

With the TOC plugin enabled, when some characters are present in the title section, the generated link in the TOC is not working.

Environment

Joplin version: 1.0.170
Platform: Windows
OS specifcs: Windows 10, portable version

Steps To Reproduce

  1. Enable the TOC plugin.
  2. Create a note
  3. Create some sections where the title contains characters such as : : @ \
  4. Click on the links for such sections in the generated TOC
  5. Nothing happen

I also attached a sample Markdown document with some examples (the Not working entries)

Describe what you expected to happen:

In the generated TOC, I聽 expect when I click on a link in the TOC to be brought to the relevant section of the note.

Logfile

I started the application with the debug window as suggested, but there simply nothing appearing in said window

Sample demo of the issue

testing [toc].txt

bug

All 11 comments

I don't think we can fix this on our side. @tessus do you have some idea? Maybe the titles need to be escaped at the plugin level?

I'm not sure, what about the slugify function? Is this an issue that is at the source or does this only manifest in Joplin? I will have to test this.

Is this somehow different to #1953?

Hmm, I just tested with git master that includes the fix from https://github.com/nagaozen/markdown-it-toc-done-right/issues/22 and special characters are still not working.

So either the plugin was fixed but for some reason it does not work in Joplin, or the plugin was not fixed. Maybe I have some time this weekend to investigate.

Does the test file/cases in the #1953 work with the git master that has the (supposed) fix? The following chars were in the those tests: ? ! # & % ( )

Nope, that's why I have to investigate. I trusted the statement of the plug-in author.

regards Helmut K. C. Tessarek

(sent from a mobile device)

How does the HTML look on the web inspector? I guess there's some small difference between the way the links are slugified and the heading anchors.

Hmm, maybe it would be wise to check (if not already) that the fix for #1843 is working?

I think I figured it out. We have to add the slugify function to the options for the toc module as well (not only for the anchor module).
I will run some more tests tomorrow.
@laurent22 If all is good, I'll open a PR, or shall I push the fix directly (w/o a PR)?

didn't let me sleep. here you go: #2052

fixed in 83c3c027d0596f36ece710a0b69d2910da1e7e42

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Dharmesh-Poddar picture Dharmesh-Poddar  路  3Comments

GingerPapa picture GingerPapa  路  3Comments

LifeIsAParadox picture LifeIsAParadox  路  3Comments

hakim89 picture hakim89  路  3Comments

deftdawg picture deftdawg  路  3Comments