markdownlint
markdownlint copied to clipboard
Add rule to check for inline-style links
A rule to dissallow inline-style links would be a nice enhancements.
Possible configuration parameters:
- Disallow all inline-style links
- Allow inline-style links in lists only
- Allow all inline-style links
Can you please give some examples to be sure I understand the request? I searched "for inline-style" links and it suggests something like the following:
<a href="..." style="something">...</a>
If so, does rule MD033 Inline HTML help? It can be used to block HTML content which should cover the first of your three scenarios.
Also, why are lists special with regard to inline-style links? Would blockquotes deserve similar treatment? Tables? Just lists?
Thanks for the clarification!
No, I didn't mean inline HTML. Some examples to clarify:
Good:
Lorem ipsum dolor sit amet, [consectetur adipiscing] elit. Etiam lectus dui, laoreet eget mauris eget, interdum blandit risus. Vestibulum ac ornare dolor, et tincidunt nulla. Suspendisse vitae dolor nec ipsum vehicula varius non et diam. Vivamus finibus libero sed tincidunt accumsan. Aliquam erat volutpat. Donec faucibus, neque ac semper blandit, est lacus placerat purus, a blandit magna diam et lorem. Maecenas tincidunt iaculis eleifend. In bibendum elementum ex, sit amet pharetra est efficitur at.
[consectetur adipiscing]: http://example.com
Bad, if not Allow all inline-style links
is set:
Lorem ipsum dolor sit amet, [consectetur adipiscing](http://example.com) elit. Etiam lectus dui, laoreet eget mauris eget, interdum blandit risus. Vestibulum ac ornare dolor, et tincidunt nulla. Suspendisse vitae dolor nec ipsum vehicula varius non et diam. Vivamus finibus libero sed tincidunt accumsan. Aliquam erat volutpat. Donec faucibus, neque ac semper blandit, est lacus placerat purus, a blandit magna diam et lorem. Maecenas tincidunt iaculis eleifend. In bibendum elementum ex, sit amet pharetra est efficitur at.
Good, if Allow inline-style links in lists
is set:
* [Google](https://google.com)
* [Bing](https://bing.com)
The general idea behind the rule would be that inline-style links makes the Markdown source file harder to read. The exception for lists is that IMHO if you make a list of just links, it's easier to read if using inline-style than reference-style links, since the link is the whole content there. More precise this exception should only be valid if there is no additional text in the list, but don't know if this is possible :)
Makes perfect sense, thank you!
For completeness, an option to disallow reference links would be nice, and/or a "consistent" option, ala ul-style.
Re-adding comment from #321, which was closed as a duplicate:
It would also be nice if this was configurable by the length of the URL — i.e. non-reference links shorter than N characters would not trigger this rule, with the default max length being 0.
Another possible criteria for which link style to use: whether or not the link destination is relative
eg.
[read destination docs](./destination/README.md)
vs
[read destination docs](https://example.com/destination)
Should autolinks be allowed?
Should autolinks be allowed?
Tentatitve decision: Autolinks should be ignored
Allow inline-style links in lists only
Another possible criteria for which link style to use: whether or not the link destination is relative
It would also be nice if this was configurable by the length of the URL — i.e. non-reference links shorter than N characters would not trigger this rule, with the default max length being 0.
Tentatitve decision: All of these should be configurable but it is not clear to me what that should look like in the schema.