Add the html_block
rule to the markdown renderer
#522
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.
The goal for all links within the guides is to evaluate them to see whether or not they leave the ".gov" TLD and if they do, we want to make sure that the class list of the link has
usa-link--external
applied so that the link gets the external link icon shown when it renders on the page.Most of the work for link checking is handled by the
link_open
rendering rule which scans all of the links within the markdown documents and then another portion is handled byhtml_inline
for instances where the HTML is placed inside the markdown document. The research for issue #348 discovered that when an HTML page is included using the 11tyinclude
syntax that neitherlink_open
norhtml_inline
parse links within the included HTML file.This commit adds a third renderer rule which scans all chunks of HTML to see if it includes any links that leave the ".gov" domain and then attempts to make sure the
usa-link--external
class is applied.Changes proposed in this pull request:
html_block
rendering rule so that anchor tags discovered within HTML files have theusa-link--external
class applied if their top level domain is something other than .govsecurity considerations
No security considerations come to mind.
Testing