1

I tried to create a link to https://docs.racket-lang.org/reference/Filesystem.html?q=rktl#(idx._(gentag._305._(lib._scribblings%2Freference%2Freference..scrbl))) using Markdown in this way:

[example](https://docs.racket-lang.org/reference/Filesystem.html?q=rktl#(idx._(gentag._305._(lib._scribblings%2Freference%2Freference..scrbl))))

But in the preview that appears when editing questions, this is rendered:

example))

... which is incorrect. It appears fine once the edit is saved, but causes an annoyance when editing.

You can observe this bug by editing this question. Take note of how this link is rendered in the preview:

example

  • If you replace the last ending parenthesis in the URL with %29, does it work? – Sonic the Anonymous WizHog Oct 22 '18 at 12:44
  • @SonictheInclusiveWerehog No. Replacing the last ending parenthesis with %29 does not work. – Flux Oct 22 '18 at 13:38
  • How about if you replace all the right parentheses in the URL with %29? – Sonic the Anonymous WizHog Oct 22 '18 at 13:49
1

In case, if parentheses ( and ) are coming inside the URL, you can escape it by \( and \).

[example](https://docs.racket-lang.org/reference/Filesystem.html?q=rktl#\(idx._\(gentag._305._\(lib._scribblings%2Freference%2Freference..scrbl\)\)\))

render as:

example

  • If the actual output is going to be the same regardless of whether or not parentheses are escaped, what is the point of escaping parentheses? – Flux Oct 22 '18 at 12:58
  • @Flux With out the backslashes, the actual output is displaying the broken link in the preview. If you are clicked on the link in the preview, it won't navigate to the expected section. – Arulkumar Oct 22 '18 at 13:04
  • Yes, broken, but only in the preview and not in the actual output displayed after saving the preview. Preview does not match actual output after saving. That's the bug. I don't see why I should always add backslashes just to get the preview working correctly... – Flux Oct 22 '18 at 13:08
  • To summarize, the bug here is that the preview mismatches the output. – Sonic the Anonymous WizHog Oct 22 '18 at 13:51
0

The use of %2F (coding) in the URL hints that the remainder of the URL is also encoded, which isn't true; that causes mode switching and resets the parentheses count.

For example:

Test of link in MarkDown rendering. - Use your URL and 🔗 Button above.

Test of link using brackets and parentheses. - Duplicate your example.

Test of link using brackets, parentheses, and backslashes. - Use no URL encoding and 🔗.

Test of link using fully encoded URL (but keeping the protocol selection unencoded).

Using your example (exactly) but using a fully unencoded URL https://docs.racket-lang.org/reference/Filesystem.html?q=rktl#(idx._(gentag._305._(lib._scribblings/reference/reference..scrbl))) (instead of a partially encoded URL, with %2F's in it) OR a fully encoded URL, excluding the protocol https://docs.racket-lang.org%2Freference%2FFilesystem.html%3Fq%3Drktl%23%28idx._%28gentag._305._%28lib._scribblings%2Freference%2Freference..scrbl%29%29%29, instead of mixing the input, produces the correct decoding in the renderer.

URLDecoder.com explains:

"... many URI schemes and protocols based on RFCs 1738 and 2396 presume that the data characters will be converted to bytes according to some unspecified character encoding before being represented in a URI by unreserved characters or percent-encoded bytes. If the scheme does not allow the URI to provide a hint as to what encoding was used, or if the encoding conflicts with the use of ASCII to percent-encode reserved and unreserved characters, then the URI cannot be reliably interpreted. Some schemes fail to account for encoding at all, and instead just suggest that data characters map directly to URI characters, which leaves it up to implementations to decide whether and how to percent-encode data characters that are in neither the reserved nor unreserved sets.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .