commonmark / cmark

CommonMark parsing and rendering library and program in C
Other
1.6k stars 534 forks source link

How to support a link with space? #485

Closed tienll closed 9 months ago

tienll commented 9 months ago

For example,

[Title](Link To The Resource)

The parsing is failed due to the space, is that possible to somehow make it work?

jgm commented 9 months ago

URI-encode the spaces as %20.

tienll commented 9 months ago

URI-encode the spaces as %20.

Thank you @jgm. Yes encoding should be working, however parsing with space can improve the readability I think. Or where is the best place that I shall begin with if I want to change the code for this?

jgm commented 9 months ago

The code is fine, it conforms to the spec:

https://spec.commonmark.org/0.30/#link-destination

As noted there, another option would be to include the whole thing in <..>, then you can use spaces (but not newlines).

tienll commented 9 months ago

<..>

Thanks, that's a great solution!