mirror of
https://github.com/caddyserver/website.git
synced 2025-04-24 14:06:17 -04:00
docs: Dynamically turn subdirectives into links to anchors (#190)
* docs: Dynamically turn subdirectives into links to anchors * Make entire rows clickable on directive page's table
This commit is contained in:
parent
3dac36ebc8
commit
c5e3aef0a2
8 changed files with 231 additions and 124 deletions
|
@ -2,6 +2,31 @@
|
|||
title: Request matchers (Caddyfile)
|
||||
---
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
// We'll add links on the matchers in the code blocks
|
||||
// to their associated anchor tags.
|
||||
let headers = $('article h3').map((i, el) => el.id.replace(/-/g, "_")).toArray();
|
||||
$('pre.chroma .k')
|
||||
.filter((k, item) => headers.includes(item.innerText))
|
||||
.map(function(k, item) {
|
||||
let text = item.innerText.replace(/</g,'<').replace(/>/g,'>');
|
||||
let url = '#' + item.innerText.replace(/_/g, "-");
|
||||
$(item).html('<a href="' + url + '" style="color: inherit;" title="' + text + '">' + text + '</a>');
|
||||
});
|
||||
|
||||
// Link matcher tokens based on their contents to the syntax section
|
||||
$('pre.chroma .nd')
|
||||
.map(function(k, item) {
|
||||
let text = item.innerText.replace(/</g,'<').replace(/>/g,'>');
|
||||
let anchor = "named-matchers"
|
||||
if (text == "*") anchor = "wildcard-matchers"
|
||||
if (text.startsWith('/')) anchor = "path-matchers"
|
||||
$(item).html('<a href="#' + anchor + '" style="color: inherit;" title="Matcher token">' + text + '</a>');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
# Request Matchers
|
||||
|
||||
**Request matchers** can be used to filter (or classify) requests by specific criteria.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue