Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/ensnode.io/config/integrations/starlight.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ export function starlight(): AstroIntegration {
collapsed: false,
autogenerate: { directory: "ensapi/contributing" },
},
{
label: "Reference",
collapsed: false,
autogenerate: { directory: "ensapi/reference" },
},
],
},
{
Expand Down
1 change: 1 addition & 0 deletions docs/ensnode.io/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"@namehash/namekit-react": "catalog:",
"@namehash/namehash-ui": "workspace:*",
"@octokit/rest": "^20.1.2",
"@scalar/astro": "^0.2.4",
"@tailwindcss/vite": "^4.1.15",
"astro": "catalog:",
"astro-font": "catalog:",
Expand Down
102 changes: 102 additions & 0 deletions docs/ensnode.io/src/components/molecules/ScalarTableOfContents.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
---
---

<nav class="scalar-toc">
<h2 class="scalar-toc-heading">On this page</h2>
<ul class="scalar-toc-list"></ul>
</nav>

<script>
function buildToc() {
const list = document.querySelector('.scalar-toc-list');
if (!list) return;

const headings = document.querySelectorAll('h2.section-header-label[id]');
if (headings.length === 0) return false;

list.innerHTML = '';
headings.forEach((h2) => {
const li = document.createElement('li');
const a = document.createElement('a');
a.href = `#${h2.id}`;
a.textContent = h2.textContent?.trim() ?? '';
li.appendChild(a);

// Find h3s that belong to this h2's section
const section = h2.closest('.section');
if (section) {
const h3s = section.querySelectorAll('h3[id]');
if (h3s.length > 0) {
const subList = document.createElement('ul');
subList.className = 'scalar-toc-sublist';
h3s.forEach((h3) => {
const subLi = document.createElement('li');
const subA = document.createElement('a');
subA.href = `#${h3.id}`;
subA.textContent = h3.textContent?.trim() ?? '';
subLi.appendChild(subA);
subList.appendChild(subLi);
});
li.appendChild(subList);
}
}

list.appendChild(li);
});

return true;
}

// Scalar renders async, so observe for headings to appear
if (!buildToc()) {
const observer = new MutationObserver(() => {
if (buildToc()) observer.disconnect();
});
observer.observe(document.body, { childList: true, subtree: true });
}
</script>

<style>
.scalar-toc {
padding: 1rem 0;
}

.scalar-toc-heading {
color: var(--sl-color-white);
font-size: var(--sl-text-xs);
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.05em;
padding-bottom: 0.5rem;
}

.scalar-toc-list {
list-style: none;
padding: 0;
margin: 0;
border-inline-start: 1px solid var(--sl-color-hairline);
}

.scalar-toc-list li a {
display: block;
padding: 0.25rem 0 0.25rem 0.75rem;
color: var(--sl-color-gray-3);
font-size: var(--sl-text-xs);
text-decoration: none;
line-height: 1.5;
}

.scalar-toc-list li a:hover {
color: var(--sl-color-white);
}

.scalar-toc-sublist {
list-style: none;
padding: 0;
margin: 0;
}

.scalar-toc-sublist li a {
padding-inline-start: 1.5rem;
}
</style>
6 changes: 3 additions & 3 deletions docs/ensnode.io/src/components/molecules/StaticHeader.astro
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import HeaderButtons from "../molecules/HeaderButtons";
<header class="fixed top-0 w-full z-20 h-[56px] py-[9px] sm:h-[70px] sm:py-4 select-none border border-b border-gray-200 bg-white">
<div class="box-border max-w-7xl mx-auto items-center justify-between flex flex-row pl-5 pr-3 sm:px-8">
<div class="flex flex-row lg:gap-2 xl:gap-7 justify-between items-center">
<div class="flex flex-row justify-between items-center gap-2 sm:gap-[14px] cursor-pointer flex-shrink-0 sm:mr-10 lg::mr-[76px]">
<div class="flex flex-row justify-between items-center gap-2 sm:gap-[14px] cursor-pointer flex-shrink-0 sm:mr-10 lg:mr-[76px]">
<a
href="/"
class="flex justify-center items-center text-black not-italic font-bold text-[21.539px] leading-[26.51px] tracking-[-0.907px] sm:text-[26px] sm:leading-8 sm:tracking-[-1.113px]"
href="/"
class="flex justify-center items-center text-black not-italic font-bold text-[21.539px] leading-[26.51px] tracking-[-0.907px] sm:text-[26px] sm:leading-8 sm:tracking-[-1.113px]"
>
<img src={ENSNode2DLight.src} class="h-8 min-[800px]:h-10" alt="ENSNode" />
</a>
Expand Down
2 changes: 1 addition & 1 deletion docs/ensnode.io/src/components/organisms/Header.astro
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import HeaderButtons from "../molecules/HeaderButtons";
<header id="site-header" class="custom_header fixed top-0 w-full z-20 h-[56px] py-[9px] sm:h-[63px] sm:py-3 select-none">
<div class="box-border max-w-7xl mx-auto items-center justify-between flex flex-row pl-5 pr-3 sm:px-8">
<div class="flex flex-row lg:gap-2 xl:gap-7 justify-between items-center">
<div class="flex flex-row justify-between items-center gap-2 sm:gap-[14px] cursor-pointer flex-shrink-0 sm:mr-10 lg::mr-[76px]">
<div class="flex flex-row justify-between items-center gap-2 sm:gap-[14px] cursor-pointer flex-shrink-0 sm:mr-10 lg:mr-[76px]">
<a
href="/"
class="flex justify-center items-center text-black not-italic font-bold text-[21.539px] leading-[26.51px] tracking-[-0.907px] sm:text-[26px] sm:leading-8 sm:tracking-[-1.113px]"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
---
import Default from "@astrojs/starlight/components/TableOfContents.astro";

import ScalarTableOfContents from "../molecules/ScalarTableOfContents.astro";
import TelegramInvite from "../molecules/TelegramInvite.astro";

const { starlightRoute } = Astro.locals;
const isApiReference = starlightRoute.slug === "ensapi/reference/api-reference";
---

<Default />
{isApiReference ? <ScalarTableOfContents /> : <Default />}
<br />
<TelegramInvite />
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
title: ENSApi API Reference
description: Interactive API reference documentation for ENSApi endpoints.
sidebar:
label: API Reference
tableOfContents:
minHeadingLevel: 6
maxHeadingLevel: 6
Comment on lines +6 to +8
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR description mentions the API reference page uses tableOfContents: false, but this frontmatter sets tableOfContents to an options object (min/max heading level 6). If the intent is to disable Starlight TOC for this page, set it explicitly to false; if the object form is intentional as a workaround, please align the PR description (or add a short comment here explaining why).

Copilot uses AI. Check for mistakes.
---

import { ScalarComponent } from "@scalar/astro";
import openapiSpec from "@workspace/docs/docs.ensnode.io/ensapi-openapi.json";

<ScalarComponent
configuration={{
content: openapiSpec,
Comment on lines +12 to +16
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Importing the full OpenAPI JSON at build time will bundle the entire spec into the page’s JS payload. If Scalar supports loading from a URL or static asset path, consider switching to that approach to reduce client bundle size and improve initial load performance (especially as the spec grows).

Suggested change
import openapiSpec from "@workspace/docs/docs.ensnode.io/ensapi-openapi.json";
<ScalarComponent
configuration={{
content: openapiSpec,
<ScalarComponent
configuration={{
spec: { url: "/ensapi-openapi.json" },

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member

@notrab notrab Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doing so would (URL) mean we can't view in our preview deployments the upcoming API spec changes. Need to investigate the static asset path though... I assume this means just putting it in the public directory, instead of where it is now in the root.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think not worth optimizing, is a-ok

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked to implement this last week but there is a lot more involved that would require changing the CI steps so we output the spec to the public directory. We could change the output directory of the generated spec (and what our CI check looks at), or copy on build to the public folder so we can use the url param of ScalarComponent. Both approaches are fine in my opinion.

I'm more inclined to follow option A to move the output directory to public so that it can be served from the docs site too, but I would do this in a separate PR. Which I can do next week @lightwalker-eth

theme: "none",
agent: { disabled: true },
hideDownloadButton: true,
hiddenClients: true,
telemetry: false,
defaultOpenAllTags: true,
expandAllResponses: true,
hideClientButton: true,
hideSearch: true,
showOperationId: true,
showSidebar: false,
showDeveloperTools: "never",
isEditable: false,
isLoading: false,
hideTestRequestButton: false,
forceDarkModeState: "light",
hideDarkModeToggle: true,
withDefaultFonts: true,
expandAllModelSections: true,
customCss: `
.light-mode {
--scalar-color-1: #121212;
--scalar-color-2: rgba(0, 0, 0, 0.6);
--scalar-color-3: rgba(0, 0, 0, 0.4);
--scalar-color-accent: var(--color-primary);
--scalar-background-1: var(--color-background);
--scalar-background-2: #f6f5f4;
--scalar-background-3: #f1ede9;
--scalar-background-accent: color-mix(in srgb, var(--color-primary) 6%, transparent);
--scalar-border-color: var(--color-border-light);
}
.scalar-mcp-layer { display: none !important; }
.scalar-app .section { padding-inline: 0 !important; }
`,
}}
/>
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,11 @@
"kysely@>=0.26.0 <0.28.14": ">=0.28.14",
"h3@<1.15.9": ">=1.15.9",
"yaml@>=2.0.0 <2.8.3": ">=2.8.3",
"picomatch@<2.3.2": ">=2.3.2",
"picomatch@<2.3.2": "^2.3.2",
"picomatch@>=4.0.0 <4.0.4": ">=4.0.4",
"smol-toml@<1.6.1": ">=1.6.1",
"brace-expansion@>=4.0.0 <5.0.5": ">=5.0.5"
"brace-expansion@>=4.0.0 <5.0.5": ">=5.0.5",
"dompurify@<3.3.2": ">=3.3.2"
},
"ignoredBuiltDependencies": [
"bun"
Expand Down
Loading
Loading