mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-27 06:07:24 -05:00
feat: stack tables at build, add section tabs
This commit is contained in:
1 parent
72e7507ff9
commit
2c71f0d3da
3 files changed
+193
-2
No files matched your search
@@ -1,6 +1,7 @@
|
||||
// The RetroBIOS site. Pages, navigation and data files are written by
|
||||
// scripts/generate_site.py; this folder holds the engine's configuration,
|
||||
// the components and the styles.
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { copyFile } from 'node:fs/promises';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { defineConfig } from 'astro/config';
|
||||
@@ -11,10 +12,27 @@ import starlightSidebarTopics from 'starlight-sidebar-topics';
|
||||
import starlightLinksValidator from 'starlight-links-validator';
|
||||
import sidebar from './src/generated/sidebar.json' with { type: 'json' };
|
||||
import lastmod from './src/generated/lastmod.json' with { type: 'json' };
|
||||
import stackTables from './src/plugins/rehype-stack-tables.mjs';
|
||||
|
||||
const SITE = 'https://abdess.github.io';
|
||||
const BASE = '/retrobios/';
|
||||
|
||||
// Old addresses that lead on to a page: {"/from/": "/to/"}, site paths
|
||||
// written by the generator. A checkout that has not run it builds with none.
|
||||
// Astro puts the base before the old address but not before the new one.
|
||||
const readRedirects = () => {
|
||||
let redirects;
|
||||
try {
|
||||
redirects = JSON.parse(readFileSync(new URL('./src/generated/redirects.json', import.meta.url), 'utf-8'));
|
||||
} catch (error) {
|
||||
if (error.code === 'ENOENT') return {};
|
||||
throw error;
|
||||
}
|
||||
const withBase = (to) => (/^https?:/.test(to) || to.startsWith(BASE) ? to : BASE + to.replace(/^\//, ''));
|
||||
const withoutBase = (from) => (from.startsWith(BASE) ? `/${from.slice(BASE.length)}` : from);
|
||||
return Object.fromEntries(Object.entries(redirects).map(([from, to]) => [withoutBase(from), withBase(to)]));
|
||||
};
|
||||
|
||||
// The sitemap keeps the address MkDocs gave it: sitemap.xml, beside the index.
|
||||
const sitemapAlias = {
|
||||
name: 'retrobios-sitemap-alias',
|
||||
@@ -30,8 +48,10 @@ export default defineConfig({
|
||||
site: SITE,
|
||||
base: BASE,
|
||||
trailingSlash: 'always',
|
||||
redirects: readRedirects(),
|
||||
markdown: {
|
||||
processor: satteri({
|
||||
hastPlugins: [stackTables()],
|
||||
features: {
|
||||
headingAttributes: true,
|
||||
definitionList: true,
|
||||
@@ -59,11 +79,21 @@ export default defineConfig({
|
||||
PageTitle: './src/components/PageTitle.astro',
|
||||
MarkdownContent: './src/components/MarkdownContent.astro',
|
||||
Footer: './src/components/Footer.astro',
|
||||
Header: './src/components/Header.astro',
|
||||
},
|
||||
routeMiddleware: ['./src/routeData.ts'],
|
||||
tableOfContents: { minHeadingLevel: 2, maxHeadingLevel: 3 },
|
||||
// Commands wrap instead of scrolling, so the end of a one-liner stays visible.
|
||||
expressiveCode: { defaultProps: { wrap: true } },
|
||||
// Commands wrap instead of scrolling, so the end of a one-liner stays
|
||||
// visible. A command block is titled (Terminal, PowerShell) and drawn
|
||||
// without the three window dots. Starlight writes the dots into each
|
||||
// theme after the global style overrides, so they are set here.
|
||||
expressiveCode: {
|
||||
defaultProps: { wrap: true },
|
||||
customizeTheme(theme) {
|
||||
theme.styleOverrides.frames = { ...theme.styleOverrides.frames, terminalTitlebarDotsOpacity: '0' };
|
||||
return theme;
|
||||
},
|
||||
},
|
||||
lastUpdated: false,
|
||||
pagination: true,
|
||||
// Measured on the queries of tools/search_gate.py, at the centre of a
|
||||
|
||||
Reference in new issue
Block a user