Closed karlhorky closed 4 years ago
Ahh, sorry, just realized that this is an incompatibility between Markdown and MDX.
Markdown does not allow for that syntax (at least on https://markdownlivepreview.com/):
I guess that it wouldn't make sense for remark
to support this.
I will see what I can do with gotOptions
or something...
Closing.
Ah yeah, HTML like this is not supported by Markdown. See CommonMark. So the URL, in GFM, is seen as an actual URL.
If you want to ignore MDX, you can use the remark-mdx
plugin. Although it won’t check href
props
Right, thanks for the explanation 👍
I'm looking to lint all of my .mdx
files for broken links, don't have any .md
files at the moment...
Hm, maybe eslint-mdx
will be helpful.
Edit: ah, maybe not: https://github.com/mdx-js/eslint-mdx/issues/203
Hmm... I guess I'll use patch-package
to remove the "
from the end of node.url
. 😅
why not use remark-mdx?
Hm, maybe I misunderstood your comment above:
If you want to ignore MDX, you can use the
remark-mdx
plugin. Although it won’t checkhref
props
I don't want to ignore MDX - I want to check it :)
Looking at remark-mdx
, can't tell - does it work with remark-lint
and remark-cli
?
Edit: I guess it does - my package.json
:
{
"remarkConfig": {
"plugins": [
"remark-mdx",
"remark-lint-no-dead-urls"
]
}
}
I don't want to ignore MDX - I want to check it :)
Well, this plugin works on markdown syntax. remark-mdx makes sure MDX is understood, but it’s still a different syntax that isn’t markdown. I don’t think there exists a project like remark-lint-no-dead-links for MDX. Would <Icon src="...">
also be checked? Etc., many new problems!
Ah, understood. So the links in format of <a href=""></a>
are not recognized as a link
with a node.url
by remark-mdx
, I suppose...
That is correct, remark/markdown does not understand HTML. And while MDX understands JSX, it does not map JSX to “equivalents” in Markdown.
Hi @davidtheclark, thanks for this library!
When I run this with the following MDX content...
...it fails as in the error message below:
remark-lint-no-dead-urls
appears to be taking the"
at the end along with the link.cc @wooorm