功能:添加 pjax/ajax

This commit is contained in:
sloray committed 2026-11-06 16:15:50 +08:00
1 parent 9d1ed54ad8
commit 703cc58d95
24 files changed
+976 -133

No files matched your search

+12
View File
@@ -24,6 +24,18 @@ let diagrams = 0;
for (const [path, html] of pages) {
const page = relative(root, path).split(sep).join('/');
const base = new URL(page.replace(/index\.html$/, ''), origin);
if (!/http-equiv="refresh"/i.test(html)) {
if (!html.includes('name="astro-view-transitions-enabled"')) {
errors.push(`${page}: missing client-side document navigation`);
}
const wordmark = html.match(/<svg\b[^>]*class="[^"]*\bsite-wordmark\b[^"]*"[^>]*>[\s\S]*?<\/svg>/)?.[0];
if (!wordmark || !wordmark.includes('<path') || /<text\b|font-family|@font-face/i.test(wordmark)) {
errors.push(`${page}: site wordmark must use static SVG paths without fonts`);
}
if (/fonts\.googleapis[^"<>]*(?:Manrope|Archivo)/i.test(html)) {
errors.push(`${page}: unexpected wordmark font request`);
}
}
if (html.includes('class="katex-error"')) errors.push(`${page}: invalid math`);
if (/<style\b[^>]*\sset:html=/.test(html)) errors.push(`${page}: MDX emitted inert SVG styles`);
const diagramCount = [...html.matchAll(/class="mermaid-diagram"/g)].length;
-24
View File
@@ -40,14 +40,6 @@ const KATEX_CDN = 'https://cdnjs.cloudflare.com/ajax/libs/KaTeX';
/** Site webfont family requested from the Google Fonts CN API in `Head.astro`. */
export const SANS_FAMILY = 'Noto Sans SC';
/**
* Heading webfont for the site title in the top-left corner. The title contains
* a Greek `Σ`, so the face must cover Greek as well as Latin: Manrope is a
* variable font (200..800) with a greek subset, and Archivo Black (weight 400)
* is requested as a separate heavy fallback.
*/
export const DISPLAY_FAMILY = 'Manrope';
const SYSTEM_SANS = [
'system-ui',
'-apple-system',
@@ -74,20 +66,6 @@ const fontStack = (families) =>
/** Site stack: the webfont first, then every plausible local fallback. */
const SANS_STACK = fontStack([SANS_FAMILY, ...SYSTEM_SANS, ...CJK_SANS, 'sans-serif']);
/**
* Display stack for the site title. Only Latin + Greek are covered by the
* webfonts, so the site's CJK fallbacks follow for any Chinese in the title.
* `Archivo Black` covers Greek and is a genuine display cut, so it is a real
* fallback rather than a placeholder.
*/
const DISPLAY_STACK = fontStack([
DISPLAY_FAMILY,
'Archivo Black',
...SYSTEM_SANS,
...CJK_SANS,
'sans-serif',
]);
/**
* Math stack. Locally installed TeX faces come first, then the platform UI
* faces for Latin/Greek symbols, then CJK faces for any Chinese inside math.
@@ -252,8 +230,6 @@ const css = `/*
--sl-font-mono: ${SANS_STACK};
--sl-font-system-mono: ${SANS_STACK};
/* Heading face for the site title; see .site-title in custom.css. */
--sl-font-display: ${DISPLAY_STACK};
}
/*