T48a Docs · Frame passes review; an id-less heading fails the build, protocol-relative links stay native
This commit is contained in:
1 parent
30dc94f44c
commit
264a9e3232
5 files changed
+7
-4
No files matched your search
@@ -50,6 +50,7 @@ function read(file: string, files: string[]): Guide {
|
||||
}
|
||||
const html = this.parser.parseInline(tokens);
|
||||
const id = slugify(words);
|
||||
if (!id) throw new Error(`docs: ${file}.md has a heading with no id: ${words}`);
|
||||
if (ids.has(id)) throw new Error(`docs: ${file}.md repeats heading ${id}`);
|
||||
ids.add(id);
|
||||
if (depth === 2) toc.push({ id, text: words });
|
||||
|
||||
@@ -35,7 +35,7 @@ export function Docs() {
|
||||
const target = e.target as HTMLElement;
|
||||
const button = target.closest<HTMLButtonElement>("button.copy");
|
||||
if (button) return void copy(button);
|
||||
const link = target.closest<HTMLAnchorElement>("a[href^='/']");
|
||||
const link = target.closest<HTMLAnchorElement>("a[href^='/']:not([href^='//'])");
|
||||
if (!link || e.metaKey || e.ctrlKey || e.shiftKey || e.button !== 0) return;
|
||||
e.preventDefault();
|
||||
const url = new URL(link.href);
|
||||
|
||||
@@ -190,8 +190,7 @@ img.shot { display: block; max-width: 100%; height: auto; }
|
||||
.prose td { color: color-mix(in srgb, var(--fg) 82%, var(--bg)); }
|
||||
.code { position: relative; margin: 28px 0; background: var(--code); border-radius: 12px; }
|
||||
.code figcaption { padding: 14px 88px 0 20px; font: 400 12px/18px var(--mono); color: var(--faint); overflow-wrap: anywhere; }
|
||||
.code pre { margin: 0; padding: 14px 20px 20px; overflow-x: auto; }
|
||||
.code button + pre { padding-top: 20px; }
|
||||
.code pre { margin: 0; padding: 16px 20px 20px; overflow-x: auto; }
|
||||
.code code { display: block; font: 400 13.5px/22px var(--mono); background: none; padding: 0; color: var(--fg); }
|
||||
.code .copy { position: absolute; top: 10px; right: 12px; padding: 4px 8px; font-size: 12px; color: var(--muted); transition: color 160ms ease-out; }
|
||||
.code .copy:hover { color: var(--fg); }
|
||||
|
||||
Reference in new issue
Block a user