-
|
Links can be ignored in many different ways, including with A common way to do this is often to add a comment like One challenge is that those comments would be file format-specific. Other tools often opt to only implement this for Markdown, but there might be some creative solutions to make this format-agnostic. I checked the issues and I do not think this has been asked before. What are your thoughts on this? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
|
As you said, we would need to handle various file formats, making the tool more complex and harder to maintain.
|
Beta Was this translation helpful? Give feedback.
-
|
Moved to a discussion, because this is technically not an issue with lychee. Hope that's fine. |
Beta Was this translation helpful? Give feedback.
-
|
One way to avoid having to understand the different file formats would be to have a start and stop marker and simply ignore everything in-between. You would then not need to care what these comments/ignored sections look like, you'd just snip out the section between the two markers before processing the file. For example: <div>
<a href="https://example.com/1">
<!-- lychee-ignore-start -->
<a href="https://example.com/2">
<!-- lychee-ignore-end -->
<a href="https://example.com/3">
</div>would turn into <div>
<a href="https://example.com/1">
<!-- -->
<a href="https://example.com/3">
</div>and doThing(
'https://example.com/1',
// lychee-ignore-start
'https://example.com/2',
// lychee-ignore-end
'https://example.com/3',
)would turn into doThing(
'https://example.com/1',
//
'https://example.com/3',
)It's a bit more verbose than an ignore-next marker, but it avoids needing to understand what 'next' means. Edit: I just noticed that this is essentially what was proposed in #1384, sorry for the noise, I had overlooked that one! |
Beta Was this translation helpful? Give feedback.
As you said, we would need to handle various file formats, making the tool more complex and harder to maintain.
For instance,
markdown-link-checkalso has edge-cases like.mdxsupport (tcort/markdown-link-check#171) or anchor links (tcort/markdown-link-check#196).--excludeand.lycheeignoreshould support that already, no? For example, instead of annotating a link in a file, why not add it to.lycheeignore?