-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
docs: make the docs overview prettier #7441
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
a00f580
8c90ee8
1a441f6
f2c4dc3
1a6c6e1
8137a39
ee8d137
114a21c
801303a
d07c880
4dae4bf
4d9a908
bde3ed7
0fae734
5a41e74
e2d9069
218c157
c32329a
4170c54
4aa97c4
15fde5d
4662f0b
1a2d095
276a9cb
435afa3
7b7256d
a6c1907
f9b4ef6
d2fa7a3
7601a59
da24f33
989b1b9
2bd78f3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,8 +8,83 @@ | |
| --md-primary-fg-color: #295DAA; | ||
| --md-accent-fg-color: #568ad6; | ||
| } | ||
|
|
||
| [data-md-color-scheme="slate"] { | ||
| --md-primary-fg-color: #295DAA; | ||
| --md-accent-fg-color: #568ad6; | ||
| } | ||
|
|
||
| /* Examples overview card grid */ | ||
| .examples-grid { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The opposite of KISS... I'd like to avoid this please.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't see a way to do this. How can we get to a more overviewy Overview page without custom styling and without using any of zenzicals features? |
||
| display: grid; | ||
| grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); | ||
| gap: 1rem; | ||
| margin-top: 1rem; | ||
| } | ||
|
|
||
| .example-card { | ||
| border: 1px solid var(--md-default-fg-color--lightest); | ||
| border-radius: 0.5rem; | ||
| text-decoration: none !important; | ||
| color: inherit !important; | ||
| transition: box-shadow 0.2s, transform 0.2s; | ||
| display: flex; | ||
| flex-direction: column; | ||
| } | ||
|
|
||
| .example-card-image { | ||
| position: relative; | ||
| overflow: hidden; | ||
| border-radius: 0.5rem 0.5rem 0 0; | ||
| } | ||
|
|
||
| .example-card:hover { | ||
| box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12); | ||
| transform: translateY(-2px); | ||
| } | ||
|
|
||
| [data-md-color-scheme="slate"] .example-card:hover { | ||
| box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4); | ||
| } | ||
|
|
||
| .example-card img { | ||
| width: 100%; | ||
| aspect-ratio: 12 / 5; | ||
| object-fit: cover; | ||
| display: block; | ||
| } | ||
|
|
||
| .example-card-content { | ||
| padding: 0.6rem 0.8rem; | ||
| } | ||
|
|
||
| .example-card-content h3 { | ||
| margin: 0 0 0.25rem; | ||
| font-size: 0.85rem; | ||
| font-weight: 600; | ||
| } | ||
|
|
||
| .example-card-content p { | ||
| margin: 0; | ||
| font-size: 0.75rem; | ||
| color: var(--md-default-fg-color--light); | ||
| line-height: 1.4; | ||
| } | ||
|
|
||
| /* Hide the right sidebar (TOC) when it has no entries */ | ||
| .md-sidebar--secondary:not(:has(.md-nav__list)) { | ||
| display: none; | ||
| } | ||
|
|
||
| .example-card-badge { | ||
| position: absolute; | ||
| top: 0.5rem; | ||
| right: 0.5rem; | ||
| padding: 0.15rem 0.5rem; | ||
| font-size: 0.75rem; | ||
| font-weight: 800; | ||
| text-transform: uppercase; | ||
| background: #285DAA; | ||
| color: white; | ||
| border-radius: 0.25rem; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| import {describe, test, expect} from 'vitest'; | ||
| import {globSync} from 'glob'; | ||
| import fs from 'fs'; | ||
|
|
||
| /** | ||
| * Show a snippet of the file around `lineNum` (1-based) with a gutter, | ||
| * highlighting the target line. If lineNum is null, shows the first few | ||
| * lines of <head> as context. | ||
| */ | ||
| function snippet(lines: string[], lineNum: number | null, file: string): string { | ||
| const target = lineNum ?? (lines.findIndex(l => /<head/i.test(l)) + 1 || 1); | ||
| const start = Math.max(0, target - 2); | ||
| const end = Math.min(lines.length, target + 2); | ||
| const gutterWidth = String(end).length; | ||
|
|
||
| const out: string[] = []; | ||
| out.push(` --> ${file}:${target}`); | ||
| out.push(`${' '.repeat(gutterWidth + 1)} |`); | ||
| for (let i = start; i < end; i++) { | ||
| const num = String(i + 1).padStart(gutterWidth); | ||
| const marker = (i + 1 === target) ? '>' : ' '; | ||
| out.push(`${num} ${marker}| ${lines[i]}`); | ||
| } | ||
| out.push(`${' '.repeat(gutterWidth + 1)} |`); | ||
| return out.join('\n'); | ||
| } | ||
|
|
||
| /** | ||
| * Find the 1-based line number of the first line matching `pattern`, | ||
| * or null if not found. | ||
| */ | ||
| function findLine(lines: string[], pattern: RegExp): number | null { | ||
| const idx = lines.findIndex(l => pattern.test(l)); | ||
| return idx >= 0 ? idx + 1 : null; | ||
| } | ||
|
|
||
| describe('Example HTML files', () => { | ||
| const exampleFiles = globSync('test/examples/*.html').sort(); | ||
|
|
||
| test.each(exampleFiles)('%s has required meta tags', (file) => { | ||
| const content = fs.readFileSync(file, 'utf-8'); | ||
| const lines = content.split('\n'); | ||
| const errors: string[] = []; | ||
|
|
||
| // Check og:description | ||
| const descriptionMatch = content.match(/<meta\s+property=["']og:description["']\s+content=["']([^"']*)["']/); | ||
| if (!descriptionMatch) { | ||
| const loc = findLine(lines, /<head/i); | ||
| errors.push( | ||
| `error: missing \`og:description\` meta tag\n${ | ||
| snippet(lines, loc, file)}\n` + | ||
| ' = help: add inside <head>:\n' + | ||
| ' <meta property="og:description" content="A short description of what this example demonstrates." />' | ||
| ); | ||
| } else if (!descriptionMatch[1].trim()) { | ||
| const loc = findLine(lines, /og:description/); | ||
| errors.push( | ||
| `error: \`og:description\` content is empty\n${ | ||
| snippet(lines, loc, file)}\n` + | ||
| ' = help: provide a meaningful description, e.g.:\n' + | ||
| ' <meta property="og:description" content="Demonstrates how to ..." />' | ||
| ); | ||
| } | ||
|
|
||
| // Check og:created | ||
| const createdMatch = content.match(/<meta\s+property=["']og:created["']\s+content=["']([^"']*)["']/); | ||
| if (!createdMatch) { | ||
| const descLine = findLine(lines, /og:description/); | ||
| errors.push( | ||
| `error: missing \`og:created\` meta tag\n${ | ||
| snippet(lines, descLine, file)}\n` + | ||
| ' = help: add right after og:description:\n' + | ||
| ` <meta property="og:created" content="${new Date().toISOString().slice(0, 10)}" />` | ||
| ); | ||
| } else if (!/^\d{4}-\d{2}-\d{2}$/.test(createdMatch[1])) { | ||
| const loc = findLine(lines, /og:created/); | ||
| errors.push( | ||
| `error: \`og:created\` has invalid date format "${createdMatch[1]}"\n${ | ||
| snippet(lines, loc, file)}\n` + | ||
| ' = help: use YYYY-MM-DD format, e.g.:\n' + | ||
| ' <meta property="og:created" content="2025-10-31" />' | ||
| ); | ||
| } | ||
|
|
||
| if (errors.length > 0) { | ||
| expect.fail( | ||
| `\n${errors.join('\n\n')}\n` | ||
| ); | ||
| } | ||
| }); | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, sorry, markdown only, no HTML.
I've seen what happened to maplibre.io repo, it's full of HTML and CSS and it's unmaintainable. I don't want that here, sorry...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but that is simply impossible in pure markdown.
I cannot do a table that flexes from 1 to 3 element.
I also don't think this is unmaintanable..
It is fairly simple html and just where I cannot get away with this otherwise
You cannot with a straight face tell me that this is better...