readthedocs / recommonmark

A markdown parser for docutils
https://recommonmark.readthedocs.io/
MIT License
340 stars 252 forks source link

Linking to heading in other file requires URL encoding #195

Closed hackdna closed 2 years ago

hackdna commented 4 years ago

The docs show that spaces are allowed in the heading link: [my subtitle](path/to/file_1:My Subtitle)

However, this doesn't produce a link but results in rendering as plain text: [my subtitle](path/to/file_1:My Subtitle)

The link is produced if the heading is URL encoded: [my subtitle](path/to/file_1:My%20Subtitle)

Either the docs should be updated or this behavior should be fixed to confirm to the docs

See also #155

gvcgael commented 4 years ago

Same problem here. Did you find any workaround ?

hackdna commented 4 years ago

URL encoding the path works (https://urlencode.org/).

gvcgael commented 4 years ago

Actually I fixed the problem with :

You can write links like this : [my subtitle](<path/to/file_1:My Subtitle>)

Lucide commented 4 years ago

I've tried [my subtitle](<path/to/file_1:My Subtitle>) but I wasn't able to reference a heading in another file. I've tried the official documented approach too. I need to create a link in a /api/functions file to a subheading "The Pen" located in /basic-concepts. I've tried with: [the pen](<basic-concepts:The Pen>) [the pen](<basic-concepts:the-pen>) [the pen](<basic-concepts#the-pen>) [the pen](<../basic-concepts#the-pen>) [the pen](</basic-concepts:the-pen>)

With and without angular brackets, plus other colon/hashtag. How do I do that? I don't want to reference a html file directly. Local links work fine.