summaryrefslogtreecommitdiffhomepage
path: root/docs/ucode.js
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2023-10-11 16:50:35 +0200
committerGitHub <noreply@github.com>2023-10-11 16:50:35 +0200
commit2b2a47240c089a2cb10223efd4a1f133638f5dd5 (patch)
tree8aca5fedc9c5584e7d66ce9774a663ea2de073bb /docs/ucode.js
parentf56394f0fc53e5c22cbe52cac0506d9fbef33cb3 (diff)
parent1c1899301a4452582ade76bb5249eaac71cceb22 (diff)
Merge pull request #175 from jow-/docs-improvements
Various documentation improvements
Diffstat (limited to 'docs/ucode.js')
-rw-r--r--docs/ucode.js32
1 files changed, 32 insertions, 0 deletions
diff --git a/docs/ucode.js b/docs/ucode.js
index 6728cdb..2377c7e 100644
--- a/docs/ucode.js
+++ b/docs/ucode.js
@@ -4,4 +4,36 @@ document.addEventListener('DOMContentLoaded', (ev) => {
if (accordionState == null || accordionState == '{}')
document.querySelectorAll('[data-isopen="false"]')
.forEach(item => item.setAttribute('data-isopen', 'true'));
+
+ const moduleName = location.pathname.match(/\/module-(.+)\.html$/)?.[1];
+
+ if (moduleName) {
+ const modulePrefix = `module:${moduleName}.`;
+
+ document.querySelectorAll(`a[href^="module-${CSS.escape(moduleName)}."]`).forEach(a => {
+ if (a.text?.indexOf(modulePrefix) == 0)
+ a.text = a.text.substring(modulePrefix.length);
+ });
+ }
+
+ document.querySelectorAll('.param-type, .type-signature').forEach(span => {
+ let replaced;
+ do {
+ replaced = false;
+ span.innerHTML = span.innerHTML.replace(/\b(Object|Array)\.&lt;((?:(?!&[lg]t;).)+)&gt;/,
+ (m, t, st) => {
+ replaced = true;
+
+ if (t == 'Object')
+ return `Object&lt;${st.replace(/,\s*/, ':&#8239;')}&gt;`;
+ else
+ return `${st}[]`;
+ });
+ } while (replaced);
+ });
+
+ document.querySelectorAll('.type-signature').forEach(span => {
+ span.innerHTML = span.innerHTML.replace(/\(nullable\) (.+)$/,
+ '$1<span class="signature-attributes">nullable</span>');
+ });
});