artempyanykh / marksman

Write Markdown with code assist and intelligence in the comfort of your favourite editor.
MIT License
1.98k stars 35 forks source link

Encoding weirdness with non-ASCII characters and spaces in file links #241

Open silverhook opened 1 year ago

silverhook commented 1 year ago

I’m writing MarkDown notes often also in languages that are not English and include non-ASCII letters. As such I sometimes store files with names that include non-ASCII characters too. Very regularly my file names include spaces too.

Here is where I found some weirdness when it comes to Marksman (at least using it in Helix).

What I would like is to continue using links to files that make sense to the filesystem/desktop too, so even if I click on then through a MarkDown viewer (or GitHub/GitLab), I get to the right file. At the very least, I would like that Marksman does not auto-generate file links that do not work elsewhere.

Testing

These are the test files I’m looking at:

 .
├── blu.markdown
├── nekje
│   ├── bla je.markdown
│   └── bla.markdown
└── šumnik.markdown

Works

The following links work, (kinda) as expected:

[inline](<./nekje/bla.markdown#test>) [[bla#test]] [[bla je#ha]] [note the space](</nekje/bla je.markdown>) [note the space](<./nekje/bla je.markdown>) [note the space](<./nekje/bla je.markdown#ha>)

These are auto-generated and work, but look weird (and probably don’t work elsewhere):

[note the space](/nekje/bla%20je.markdown) [note the special char](/%C5%A1umnik.markdown)

Does not work

And these simply do not work (within Marksman), although I would assume they should:

[test][beh]

[beh]: ./nekje/bla je.markdown
[test][beh]

[beh]: <./nekje/bla je.markdown>

[note the space](<./nekje/bla je.markdown>#ha)

artempyanykh commented 1 year ago

Hi @silverhook! Regarding things like [note the special char](/%C5%A1umnik.markdown) -- the text of the url should be url-encoded (or perhaps quoted with <, >). Url-encoded links work on github and gitlab. I guess from the UX standpoint having a choice between url-encoding or '<>` quoting would be nice! (Perhaps quoting should be the default...?)

Now regarding what "does not work": to clarify, only 'reference' links don't work?

silverhook commented 1 year ago

My concern about the URL-encoding is that when it comes to files on the disk it’s a bit confusing. <>-quoting by default (or at least as setting) would be nice :)

Neither of the reference links works, but also the last example does not work. In the last one, I think the issue is that the anchor is outside of the <>-quotation, which I guess is intended not to work.