link directives to response matchers documentation

This commit is contained in:
Arsh 2025-01-09 13:54:44 -05:00
parent 0a84fcf49a
commit d90b27681f
No known key found for this signature in database
GPG key ID: B09B8AE8D3751F1F
5 changed files with 44 additions and 20 deletions

View file

@ -55,6 +55,19 @@ $(function() {
let text = item.innerText.replace(/</g,'&lt;').replace(/>/g,'&gt;');
$(item).html('<a href="/docs/caddyfile/matchers#syntax" style="color: inherit;" title="Matcher token">' + text + '</a>');
});
// Add links to [<matcher>] or named matcher tokens in code blocks.
// The matcher text includes <> characters which are parsed as HTML,
// so we must use text() to change the link text.
$('pre.chroma .s:contains("<response_matcher>")')
.add('pre.chroma .s:contains("<inline_response_matcher>")')
.map(function(k, /** @type { HTMLElement } */ item) {
const anchor = document.createElement("a");
anchor.href = "/docs/caddyfile/response-matchers#syntax";
anchor.style.color = "inherit";
anchor.title = "Response matcher token";
item.replaceWith(anchor);
anchor.appendChild(item);
});
// Wrap all tables in a div so we can apply overflow-x: scroll
$('table').wrap('<div class="table-wrapper"></div>');