Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reintroduce anchor detection as configurable step #25

Merged
merged 1 commit into from
Mar 10, 2024

Conversation

aepfli
Copy link
Contributor

@aepfli aepfli commented Jan 11, 2023

Note: this is just a suggestion as I stumbled upon this and thought this is a suitable contribution. It is hard to grasp why anchor detection was removed, but this unites both worlds, at least.

Anchor detection got removed during refactoring, as a link will still point to a sufficient URL with a broken anchor. It still generates wrong/broken links, especially when markdown is used to generate pages that are checked with tools like HTMLtest, which verify proper anchors etc.

So, I reintroduce this change with this pr but as a configurable option. This should still allow the proper outcome of the refactoring but ensures backward compatibility for other users who rely on proper anchor handling.

Relates: #24

Signed-off-by: Simon Schrottner [email protected]

@aepfli aepfli force-pushed the making_anchor_detection_configurable branch from b52956e to dc3c827 Compare January 11, 2023 13:47
Anchor detection got removed during refactoring, as a link will
still point to a sufficient url with a broken anchor, it still
generates wrong/broken links. Especially when markdown is used
to generate pages which are checked with tools like HTMLtest,
which do verify proper anchors etc.

Therefore i reintroduce this change with this pr, but as a
configurable option. This should still allow the proper
outcome of the refactoring, but ensures backwards compatibility
for other users who rely on proper anchor handling.

Relates: tcort#24

Signed-off-by: Simon Schrottner <[email protected]>
@aepfli aepfli force-pushed the making_anchor_detection_configurable branch from dc3c827 to 34a545a Compare January 11, 2023 13:50
@aepfli
Copy link
Contributor Author

aepfli commented Jan 11, 2023

If this is a desirable change, I can also provide an update for https://github.com/tcort/markdown-link-check

@@ -3,13 +3,33 @@
const { marked } = require('marked');
const htmlLinkExtractor = require('html-link-extractor');

module.exports = function markdownLinkExtractor(markdown, extended = false) {
module.exports = function markdownLinkExtractor(markdown, checkAnchors = false) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively, we could pass in an Object. This way, we don't confuse people who have been used to extended - and we're future-proof to provide more configuration options.

@aepfli
Copy link
Contributor Author

aepfli commented Jan 12, 2023

seems like tcort/markdown-link-check#212 would be solved by this

@matthandus
Copy link

Hi @tcort , can we have a new release that includes this PR to support anchor detection again? Thank you for this awesome project!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants