unison icon indicating copy to clipboard operation
unison copied to clipboard

Url links inside parenthetical statements are not interpreted as such

Open rlmark opened this issue 1 year ago • 3 comments

If you create a standard url link inside a parenthetical statement, the links may not be rendered as actual links.

For example the following doc block will fail to interpret the first link as a valid link:

docRepro = {{
  Link link link blah ([myLink](www.google.com), [anotherLink](www.google.com))
}}

Screen Shot 2024-01-23 at 3 41 36 PM

If the parenthetical is not immediately started with a link, you are able to successfully incorporate url links:

linkNotAtBeginning = {{
  Text text blah (something something [myLink](www.google.com) blah blah blah)
}}

A transcript is attached with the doc code capable of producing the issue, but the issue is best seen in the local ui or unison share.

parentheticalLink.md

rlmark avatar Jan 23 '24 23:01 rlmark

Here's another example of similar issue, where parser fails to understand braces ( ) in URLs.

Live example of Bytes.flatten.doc in base library:

https://share.unison-lang.org/@unison/base/code/releases/2.12.0/latest/terms/Bytes/flatten

shot-2024-02-06-at-12-56-55--area

Where rope link defined as:

[rope](https://en.wikipedia.org/wiki/Rope_(data_structure))

Parser need to be smarter about certain cases or URLs. ( and ) is totally valid characters in URL and doesn't need to be URL-encoded.

But i understand that it might be difficult to implement in the parser, which looks for closing ) while parsing links.

andreystepanov avatar Feb 06 '24 11:02 andreystepanov

Meanwhile i fixed doc link via contribution, by using %28/%29 encoded braces.

https://share.unison-lang.org/@unison/base/contributions/15

andreystepanov avatar Feb 06 '24 11:02 andreystepanov

Instead of dealing with markdown parser for links, maybe we can just extend Doc data-type:

unique type Doc
  = ...
  | Link Doc Doc
  | ...
  | ...

This way it might be easier to link images and other kind of documentation elements too.

andreystepanov avatar Feb 06 '24 11:02 andreystepanov

Duplicate of #2483.

sellout avatar Jul 09 '24 06:07 sellout