[\s\S]*?<\/div>/,
- `
`
- )
.replaceAll('href="/testbed/"', 'href="#section-16"')
.replaceAll('href="spec-v0.2.html"', 'href="/spec/v0.2/"')
.replaceAll('href="spec.html"', 'href="/spec/"')
@@ -94,19 +64,8 @@ function rewrite(html, archive) {
)
.replace(/
([^<]+)<\/a>/g, "$1")
.replace(/([^<]+)<\/a>/g, "$1")
- .replace(/href="\.\/\d{2}-[^"#]+\.md#([^"]+)"/g, 'href="#$1"')
- .replace(
- "",
- ` \n`
- + ` \n`
- + ` \n`
- + ` \n`
- + ` \n`
- + ` \n`
- + ` \n`
- + ` \n`
- + ""
- );
+ .replace(/href="\.\/\d{2}-[^"#]+\.md#([^"]+)"/g, 'href="#$1"');
+ return renderSpecPage(readFileSync(shellPath, "utf8"), content, archive);
}
function addSitemapRoutes() {
diff --git a/scripts/spec-page.mjs b/scripts/spec-page.mjs
new file mode 100644
index 0000000..1924bc8
--- /dev/null
+++ b/scripts/spec-page.mjs
@@ -0,0 +1,18 @@
+export function renderSpecPage(shell, source, archive) {
+ const navigation = source.match(/