flying-sheep / rust-rst

a reStructuredText parser and renderer
https://crates.io/crates/rst
Apache License 2.0
100 stars 10 forks source link

Words with colons incorrectly render to links #18

Closed sooda closed 4 years ago

sooda commented 4 years ago

Some standalone hyperlinks are intended to be recognized and rendered into clickable links. However, some text that just remotely resembles a link seems to be parsed into a link, e.g. foo:bar.

This seems to be caused by the arbitrary link scheme in the parser being too permissive.

Compared to docs from https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html

The scheme is the name of the protocol, such as "http", "ftp", "mailto", or "telnet". The scheme consists of an initial letter, followed by letters, numbers, and/or "+", "-", ".". Recognition is limited to known schemes, per the Official IANA Registry of URI Schemes and the W3C's Retired Index of WWW Addressing Schemes.

sooda commented 4 years ago

See PR #19 for an executable demo.

flying-sheep commented 4 years ago

Fixed by #19