Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Section link normalisation does not follow Obsidian's built-in normalisation behaviour #2218

Open
indianakernick opened this issue Jan 24, 2024 · 1 comment
Labels
bug Something isn't working.

Comments

@indianakernick
Copy link

What happened?

I'm finding that when certain characters are used in headings, the links are broken only when they are parsed by Dataview. In my case, I have a heading that contains a (that's U+2019). Linking to this heading works fine with Obsidian's built-in features but Dataview replaces that character with a space during parsing which produces a broken link. More experimentation revealed that all punctuation seems to cause the problem but Obsidian's native functionality works correctly.

The problem seems to be with the way that headers are normalised. It's stripping out more characters than Obsidian does. This normalisation needs to be relaxed.

I can sort of work around this by doing the parsing myself but there are some situations where it's not possible to get back the original string such as with CSVs for example. At that point, it becomes necessary to do the CSV parsing yourself just so that links can be parsed correctly. Of course, the other workaround is to avoid punctuation in headers.

DQL

No response

JS

No response

Dataview Version

0.5.64

Obsidian Version

1.5.3

OS

MacOS

@indianakernick indianakernick added the bug Something isn't working. label Jan 24, 2024
@PabloEscodebar
Copy link

On Windows I get the same problem. If there are multiple headers that only differ by punctuation, the link doesnt break but it will link to the wrong section (the first one).

With file "test.md" containing:

## Heading!!
- [ ] task A
## Heading
- [ ] task B

Then a dataviewjs block:

let result = await dv.query("TASK FROM \"test\"");
let task = result.value.values[1];
dv.taskList([task], false);
dv.paragraph(task.section);

renders task B, but a link to the section of task A.
using Head'ing and Heading would still break but not Head'ing and Head ing since the punctuation is replaced with a space
(same for Head!ing and Head?ing)

Hope this helps

Dataview Version

0.5.64

Obsidian Version

1.5.3

OS

Windows

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working.
Projects
None yet
Development

No branches or pull requests

2 participants