Fix broken reference links in shortcodes #2073
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There are still a few docs with broken reference links that were not fixed in PR #2068
The Problem
Reference links can not be shared between Markdown in a Hugo shortcode and Markdown in the main document. This is because the shortcode is rendered in a different context than the main document. For example, the reference link in the
noteshortcode will be rendered as plain text:Because Hugo renders the shortcode in a different context, the reference could technically be duplicated inside in the shortcode. For example:
However, Markdownlint is not aware of Hugo's rendering context and will output the following linting error:
The Solution
Unfortunately, Markdownlint will not be able to catch these broken reference links.
With this PR, all reference links inside a shortcode have been replaced with regular links, or with self-contained reference links that use names that are not used in the main document.
Testing
I searched for every
noteandwarningshortcode and verified that the content did not share reference links with the main document.I searched for "][" in the Hugo public directory, and none of the results were broken reference links.