Comments (7)
Thanks for the example! As you note, the issue is with a Hugo-specific syntax which is not part of CommonMark or GFM and therefore not recognized. You may wish to disable this rule for that line or file or project.
(If this pattern is common, you could also add ".pdf"
to the allow-list.)
https://github.com/DavidAnson/markdownlint#configuration
from markdownlint.
Thank you for the quick response. My thought process here is that since the link syntax is still the same, this is something that is not necessarily incompatible with Markdown standards. (I am not an expert though and happy to be corrected.) At the same time, I recognize that this is unusual. If it is compatible with the link syntax ([text](<link>)
), I am hoping that a parsing change here will allow it to work with the usual link syntax, regardless of what appears inside <link
>.
Again, I am neither an expert nor a maintainer. The above is just a theory of how it could work. If you think this is workable, I'll appreciate it very much. FWIW, I am not facing issues with version 0.32.2 of the markdownlint-cli (corresponds to 0.26.2 of markdownlint).
from markdownlint.
This library is moving to use micromark for Markdown parsing: https://github.com/micromark/micromark
Searching very briefly, I do not see that anyone has added support for Hugo syntax: https://www.npmjs.com/search?q=Micromark%20Hugo%20
from markdownlint.
Thanks for the tip. I also think I was not entirely clear in my initial message. I am not asking to support Hugo syntax here. I only used that to show the problem. In my view, the parser should just interpret everything between the two braces (
and )
as a link and then not match proper names there. This already works for regular links but it breaks if special characters such as {
and <
come in.
Moreover, if you are moving to micromark for parsing, maybe they already handle this and you don't have to do anything. I will wait for the move and stick with the old version of the CLI for now.
Question: is there a planned release for micromark parsing or is it uncertain right now?
from markdownlint.
This rule has already been converted to use the micromark parser. The issue is that the Hugo syntax here is not a valid link according to the CommonMark specification: https://spec.commonmark.org/0.30/#links. Because it is not a valid link, it is treated as normal text and does not get the special treatment links do. If Hugo support were incorporated into micromark as an extension, this syntax would presumably be recognized as a link and the behavior you want would automatically result.
from markdownlint.
Thanks. That was very helpful. I found this (emphasis added):
A link destination consists of either
...
a nonempty sequence of characters that does not start with <, does not include ASCII control characters or space character, and includes parentheses only if (a) they are backslash-escaped or (b) they are part of a balanced pair of unescaped parentheses.
This means that the only reason this does not get parsed as a link is because of the space. There are no ASCII control characters and the parentheses are balanced.
Moreover, it turns out that Hugo doesn't care about spaces at all. So, if I remove all the spaces, it works for both markdownlint and Hugo. Example.
Still, I think this is hacky. Removing spaces in the beginning and end is one thing but it is very weird to remove the space between relref
and the path. Like this: [Link 3]({{<relref'docs/organization.pdf'>}})
.
So, I think my best option is to ignore the line with markdownlint-disable-next-line
.
I'm okay to close this unless you have other ideas. I hope this finding is useful to someone or to me in the future 😀.
from markdownlint.
It's great that you figured that out! I assumed spaces were required and didn't think to suggest removing them. Good for you experimenting. :) I will go ahead and close this issue.
from markdownlint.
Related Issues (20)
- MD051 false positive `## $\LaTeX$ hooks` ⟼ `[latex hooks](#latex-hooks)` HOT 1
- MD013 false positive when url contains # HOT 8
- Formatter functionality: adjust table size to its content HOT 8
- MD051 support icon HOT 11
- 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 8
- `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
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.