Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc_markdown should ignore plain URLs #1832

Closed
behnam opened this issue Jun 15, 2017 · 6 comments
Closed

doc_markdown should ignore plain URLs #1832

behnam opened this issue Jun 15, 2017 · 6 comments

Comments

@behnam
Copy link

behnam commented Jun 15, 2017

The doc_markdown rule is expected to search the plain text of a Markdown content, and should exclude non-plain-text parts, like code blocks and URLs.

Plain URLs (not labeled links or URLs in brackets) are core components of markdown and should be respected as URLs and not plain text.

From the perspective of what's going on in practice: when implementing a spec in code, it's very common to put a plain URL link to the spec, as a point of reference. These URLs are most of the time very well self-descriptive and there's no need for extra work to label them.

Example: all the URLs like http://www.unicode.org/reports/tr9/... here: https://github.com/servo/unicode-bidi/blob/master/src/explicit.rs

Based on these, clippy should no warn about any formatting issues about pain URLs, specially the backtick requirement.

Also reported back in Feb: https://github.com/Manishearth/rust-clippy/issues/1558

@Manishearth
Copy link
Member

This will probably get fixed by https://github.com/Manishearth/rust-clippy/pull/1799

cc @mcarton

Up till now we had a thing that would kind of parse a subset of markdown.

@mcarton
Copy link
Member

mcarton commented Jun 17, 2017

No it won't. A raw link like this is considered text in CommonMark. If you really want a raw link you need </> around it. See the spec, specifically example 580.

And those links are not rendered by rustdoc itself anymore with --enable-commonmark, so clippy really is in its right to lint here.

@Manishearth
Copy link
Member

We should probably catch raw links and report them.

@behnam
Copy link
Author

behnam commented Jun 18, 2017

Yeah, if rustdoc won't (under CM) linkify them, then it makes sense to treat them as text, and even report them.

@behnam
Copy link
Author

behnam commented Jun 18, 2017

Actually, looks like the doc_markdown rule (clippy v0.0.140) still warns on URL components for Autolinks (when URL is surrounded by angle brackets)!

warning: you should put `Reordering_Resolved_Levels` between ticks in the documentation
  --> src/deprecated.rs:23:42
   |
23 | /// <http://www.unicode.org/reports/tr9/#Reordering_Resolved_Levels>
   |                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: #[warn(doc_markdown)] on by default
   = help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#doc_markdown

warning: you should put `Directional_Formatting_Characters` between ticks in the documentation

@mcarton
Copy link
Member

mcarton commented Jun 18, 2017

Ok, this I can fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants