Comments (8)
The "Not ok" example above CAN be shortened by removing the space character or turned into a non-breakable line by replacing the space with a newline character. If either is done, MD013 does not report a violation:
from markdownlint.
That's indeed the case, but there is still an inconsistency: both lines are over the limit, but only the URL with the # in it is reported. I would suspect either both of them or neither of them to be reported.
Since both lines have no spaces in them and I run with strict = false
and stern = true
it should report none of them.
from markdownlint.
I updated the documentation for this rule last night to try to clarify two points (see link above), but this is the relevant part from the published package documentation and was not changed:
To warn for lines that are too long and could be fixed but allow long lines without spaces, set the stern parameter to true.
The first line of your example is too long without spaces, so is allowed; the second line of your example is too long and could be shortened, so is reported. The behavior you report is behaving as documented for for your configuration.
from markdownlint.
With the following configuration
MD013:
line_length: 30
heading_line_length: 30
code_block_line_length: 30
code_blocks: true
tables: true
headings: true
strict: false
stern: true
and markdown document:
## Title with size equal limit
[ok](https://example.com)
[also ok](https://example.com)
[ok](https://example.com/extra)
[not ok](https://example.com/extra)
[also_ok](https://example.com/extra)
What I don't like about this behavior is that the one that is not ok, cannot be broken at the space that causes it to be reported. You can only break the link after (
and before )
.
The most logical handling (in my opinion) would be the same behaviour for the last three lines. Because all three lines can be broken at the parentheses to get inside the limit:
## Title with size equal limit
[ok](
https://example.com/extra)
[not ok](
https://example.com/extra)
[also_ok](
https://example.com/extra)
I would suggest to report neither of the three with the current settings. Every line that has no breakable spaces should not be reported when stern = true
and strict = false
.
from markdownlint.
This rule is based on line-breaking via whitespace - a technique pretty much everybody knows about. I think very few people know about breaking within the link destination as you show above and I would not want to confuse people. In the case of links, I think reference links (i.e., [link][reference]
) are a better approach than inline links because their shorter length tends to make discussions like the above unnecessary.
Also, it IS acceptable to include a line break in the link text:
https://dlaa.me/markdownlint/#%25m%23%20Heading%0A%0A%5Bperfectly%0Afine%5D(https%3A%2F%2Fexample.com%2F)%0A
from markdownlint.
I didn't know you could break in the link text. There are downsides to reference links as well though, and I suppose that markdownlint is meant to lint all kind of markdown files. But for this issue, I guess I'll format my links differently then to avoid this situation, but it doesn't feel ideal.
from markdownlint.
(Deleted SPAM comment)
from markdownlint.
@DavidAnson You can close the issue if you want.
from markdownlint.
Related Issues (20)
- Enhance rule MD033 to be more specific/targetted HOT 7
- MD004 overwritten by prettier HOT 4
- MD009: Add option to remove trailing spaces in code blocks
- No bare-urls when using _redirects file HOT 1
- MD033 - Inline HTML Not ignoring custom HTML tags, but recognizing them as tags HOT 2
- MD033: Organizing information with collapsed sections HOT 7
- MD045: no-alt-text triggered even though html alt-text is specified HOT 2
- QUESTION: Is it possible to write custom linting rules, including Quick Fix information, for frontmatter? HOT 2
- Copyright HOT 1
- MD056/table-column-count counts pipes inside backticks as column separators HOT 2
- MD014 only considers the `$` sign, is this intentional? HOT 2
- Umlauts like Ä, Ö, Ü in Mailadresses/URLs are not detected as normal letters HOT 5
- HTML disable/enables comments triggered when inside Markdown inline code HOT 4
- Frontmatter interpreted as top-level heading HOT 5
- `markdownlint-disable-next-line` should apply to the next non-empty line HOT 1
- MD045 shown when image has alt text in the optional title HOT 3
- MD029/ol-prefix: Continuous list with more than 10 elements HOT 1
- Include additional schema/types for strict rule name verification HOT 2
- Diabling rules from the front matter? HOT 2
- 11 12 14 16 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from markdownlint.