mirror of
https://github.com/caddyserver/website.git
synced 2025-04-27 23:46:16 -04:00
docs: Use headers for individual global options, anchor linkable (#100)
This commit is contained in:
parent
828e4a4eb4
commit
6b4998a5dc
2 changed files with 76 additions and 22 deletions
|
@ -60,4 +60,23 @@ $(function() {
|
|||
.find('a')
|
||||
.text(text);
|
||||
});
|
||||
|
||||
// On the global options page only, we'll add links to the options to the anchor tags
|
||||
if (window.location.pathname === '/docs/caddyfile/options') {
|
||||
let headers = $('article h5').map(function (i, el) {
|
||||
return el.id.replace(/-/g, "_");
|
||||
}).toArray();
|
||||
$('pre.chroma .k')
|
||||
.filter(function (k, item) {
|
||||
return headers.includes(item.innerText);
|
||||
})
|
||||
.map(function(k, item) {
|
||||
let text = item.innerText;
|
||||
let url = '#' + item.innerText.replace(/_/g, "-");
|
||||
$(item)
|
||||
.html('<a href="' + url + '" style="color: inherit;" title="Global option"></a>')
|
||||
.find('a')
|
||||
.text(text);
|
||||
});
|
||||
}
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue