docs: Add links to Caddyfile directives in code blocks (#82)

This commit is contained in:
Francis Lavoie 2020-09-16 15:59:49 -04:00 committed by GitHub
parent ec9e966e55
commit 99c602bf11
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 0 deletions

View file

@ -30,4 +30,20 @@ $(function() {
// to the outer pre element, and our CSS file has a style to
// ensure the inner code block does not produce extra padding
$('article > pre:not(.chroma) > code:not(.cmd)').parent().addClass('chroma');
// Add links to Caddyfile directives in code blocks.
// See include/docs-head.html for the whitelist bootstrapping logic
$('pre.chroma .k')
.filter(function (k, item) {
return window.CaddyfileDirectives.includes(item.innerText);
})
.map(function(k, item) {
$(item).html(
'<a href="/docs/caddyfile/directives/' + item.innerText + '"'
+ 'style="color: inherit;"'
+ '>'
+ item.innerText
+ '</a>'
);
});
});