Skip to content

Commit 98e4bfe

Browse files
committed
refactor(css): reorganize styles into modular architecture
- Split monolithic style.css into common.css, content.css, and home.css - Add glass effect header with adjustable transparency and blur - Create shared .content-main class (unified from .api-content/.doc-content) - Consolidate markdown styles for .module-doc, .api-markdown, .markdown-content - Simplify home page header (remove nav links and search) - Fix mobile overflow issues for tables, code blocks, and API signatures - Add responsive property/param header layout for mobile
1 parent 1d84d3b commit 98e4bfe

11 files changed

Lines changed: 2579 additions & 2353 deletions

File tree

lib/markdown.ts

Lines changed: 51 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,60 @@ marked.use({
3636
const title = token.title ? ` title="${token.title}"` : "";
3737
return `<a href="${href}"${title}>${token.text}</a>`;
3838
},
39+
table(token: Tokens.Table): string {
40+
// Wrap table in scrollable container for mobile
41+
let header = "";
42+
let body = "";
43+
44+
// Build header row
45+
let headerRow = "";
46+
for (let j = 0; j < token.header.length; j++) {
47+
const cell = token.header[j];
48+
const align = token.align[j];
49+
const alignAttr = align ? ` style="text-align:${align}"` : "";
50+
// deno-lint-ignore no-explicit-any
51+
const content = (this as any).parser.parseInline(cell.tokens);
52+
headerRow += `<th${alignAttr}>${content}</th>`;
53+
}
54+
header = `<thead><tr>${headerRow}</tr></thead>`;
55+
56+
// Build body rows
57+
if (token.rows.length > 0) {
58+
let bodyRows = "";
59+
for (let i = 0; i < token.rows.length; i++) {
60+
const row = token.rows[i];
61+
let rowHtml = "";
62+
for (let j = 0; j < row.length; j++) {
63+
const cell = row[j];
64+
const align = token.align[j];
65+
const alignAttr = align ? ` style="text-align:${align}"` : "";
66+
// deno-lint-ignore no-explicit-any
67+
const content = (this as any).parser.parseInline(cell.tokens);
68+
rowHtml += `<td${alignAttr}>${content}</td>`;
69+
}
70+
bodyRows += `<tr>${rowHtml}</tr>`;
71+
}
72+
body = `<tbody>${bodyRows}</tbody>`;
73+
}
74+
75+
return `<div class="table-wrapper"><table>${header}${body}</table></div>\n`;
76+
},
3977
},
4078
});
4179

42-
/** Parse markdown content to HTML */
43-
export function parseMarkdown(content: string): string {
44-
return marked.parse(content, { async: false }) as string;
80+
/**
81+
* Parse markdown content to HTML
82+
* @param content - Markdown content
83+
* @param headerExtra - Optional HTML to insert after h1 inside header
84+
*/
85+
export function parseMarkdown(content: string, headerExtra?: string): string {
86+
const html = marked.parse(content, { async: false }) as string;
87+
// Wrap first h1 in <header class="content-header">
88+
const extra = headerExtra ?? "";
89+
return html.replace(
90+
/^(<h1[^>]*>.*?<\/h1>)/,
91+
`<header class="content-header">$1${extra}</header>`,
92+
);
4593
}
4694

4795
/**

probitas/site-health.probitas.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ export default scenario("Probitas docs site health", {
121121
}
122122
})
123123
.step("serves static assets", async ({ resources }) => {
124-
const res = await resources.http.get("/static/style.css");
124+
const res = await resources.http.get("/static/common.css");
125125
expect(res).toBeOk().toHaveStatus(200).toHaveHeadersPropertyContaining(
126126
"content-type",
127127
"text/css",

0 commit comments

Comments
 (0)