summaryrefslogtreecommitdiffhomepage
path: root/docs
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2023-10-11 15:58:50 +0200
committerJo-Philipp Wich <jo@mein.io>2023-10-11 16:33:51 +0200
commit4a8ece2534ad72668be0016084dd15083b96b3f0 (patch)
treeb417cd777487fcbbdce11954f8365383875d4539 /docs
parentfcd39e290f58e3c598b976fb78a8fefaad3946ba (diff)
docs: use CSS and local JavaScript fixups to improve formatting
- Reduced margins - Better visual separation of method descriptions - Improved display of argument and return value attributes - Improved display of object and array type descriptions - Shortened absolute module name paths The local JavaScript fixups are a stop-gap measure for now, in the long it likely makes more sense to fork the used JSDoc theme to apply the desired changes directly to the markup. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'docs')
-rw-r--r--docs/ucode.css81
-rw-r--r--docs/ucode.js32
2 files changed, 113 insertions, 0 deletions
diff --git a/docs/ucode.css b/docs/ucode.css
index a40f478..966228a 100644
--- a/docs/ucode.css
+++ b/docs/ucode.css
@@ -6,6 +6,24 @@ h1 {
display: flex;
}
+h3[id].name:not(h2 + h3) {
+ margin-top: 2.5rem;
+ border-top: 1px solid #292929;
+ padding-top: 1.5rem;
+}
+
+h3[id].name:not(h2 + h3) .link-anchor {
+ top: 1.5rem;
+}
+
+.light h3[id].name {
+ border-color: #ccc;
+}
+
+html body {
+ line-height: 1.5;
+}
+
article .description > ul,
article .description > ol {
list-style: initial;
@@ -18,3 +36,66 @@ article .description > ol {
background-position: 1rem center;
padding-left: 3rem;
}
+
+section table td:first-child,
+section .params td:first-child,
+section table thead th:first-child,
+section .params thead th:first-child,
+section .props thead th:first-child {
+ border-top-left-radius: .5rem;
+ border-bottom-left-radius: .5rem;
+}
+
+section table td:last-child,
+section .params td:last-child,
+section table thead th:last-child,
+section .params thead th:last-child,
+section .props thead th:last-child {
+ border-top-right-radius: .5rem;
+ border-bottom-right-radius: .5rem;
+}
+
+section .params td,
+section .params th,
+section .props td,
+section .props th,
+section th,
+section td,
+section .details .details-item-container {
+ padding: .5rem 1rem;
+}
+
+section ul,
+section ol {
+ padding-left: 1.5rem;
+}
+
+section ul li,
+section ol li {
+ padding: .25rem 0;
+}
+
+section p {
+ margin: .75rem 0;
+}
+
+section .details {
+ border-radius: .5rem;
+}
+
+section .pre-div {
+ margin: 1rem 0;
+ border-radius: .5rem;
+}
+
+.param-type {
+ font-family: "code";
+}
+
+.signature-attributes {
+ font-variant: sub;
+}
+
+.method-member-container > strong + dl.param-type > dt {
+ display: none;
+}
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>');
+ });
});