Skip to content

Commit 53bc1a4

Browse files
committed
style(wiki): move breadcrumbs into title banner
1 parent e2b2315 commit 53bc1a4

7 files changed

Lines changed: 51 additions & 19 deletions

File tree

docs/.vitepress/theme/style.css

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2286,6 +2286,33 @@ body.has-calendar-dialog {
22862286
box-shadow: var(--site-shadow);
22872287
}
22882288

2289+
.wiki-breadcrumb {
2290+
display: flex;
2291+
margin: 0 0 22px;
2292+
align-items: center;
2293+
color: var(--site-text-3);
2294+
flex-wrap: wrap;
2295+
gap: 6px 9px;
2296+
font-size: 16px;
2297+
line-height: 1.55;
2298+
}
2299+
2300+
.wiki-breadcrumb a {
2301+
color: var(--site-text-3);
2302+
font-weight: 580;
2303+
text-decoration: none;
2304+
transition: color 150ms ease;
2305+
}
2306+
2307+
.wiki-breadcrumb a:hover {
2308+
color: var(--site-brand);
2309+
}
2310+
2311+
.wiki-breadcrumb span {
2312+
color: var(--site-line-strong);
2313+
user-select: none;
2314+
}
2315+
22892316
.session-banner .section-index {
22902317
color: var(--site-brand);
22912318
font-family: var(--vp-font-family-mono);

docs/en/wiki/F9oKw4GUgi30lQkgWScckzjfnfd.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ outline: deep
55
lastUpdated: false
66
---
77

8-
[AI Infra Seminars Wiki](/en/wiki/) / [Topic 1 — Kernel and ML Compilers](/en/wiki/VWJPwVFTHifeadkE4phc45hOntg)
9-
108
<header class="session-banner wiki-page-banner">
9+
<nav class="wiki-breadcrumb" aria-label="Document path"><a href="/en/wiki/">AI Infra Seminars Wiki</a><span aria-hidden="true">/</span><a href="/en/wiki/VWJPwVFTHifeadkE4phc45hOntg">Topic 1 — Kernel and ML Compilers</a></nav>
1110
<span class="section-index">Course Materials</span>
1211
<h1>Session 00 — From HPC to AI Infra: Parallel Computing and Parallel Programming</h1>
1312
</header>

docs/en/wiki/WHFXw13vEiD8Hikfp3ScU33JnXe.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ outline: deep
55
lastUpdated: false
66
---
77

8-
[AI Infra Seminars Wiki](/en/wiki/) / [Topic 1 — Kernel and ML Compilers](/en/wiki/VWJPwVFTHifeadkE4phc45hOntg)
9-
108
<header class="session-banner wiki-page-banner">
9+
<nav class="wiki-breadcrumb" aria-label="Document path"><a href="/en/wiki/">AI Infra Seminars Wiki</a><span aria-hidden="true">/</span><a href="/en/wiki/VWJPwVFTHifeadkE4phc45hOntg">Topic 1 — Kernel and ML Compilers</a></nav>
1110
<span class="section-index">Course Materials</span>
1211
<h1>Session 01 — GPU Programming Model</h1>
1312
</header>

docs/wiki/F9oKw4GUgi30lQkgWScckzjfnfd.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@ lastUpdated: false
77

88
<!-- 此文件由 npm run sync:feishu 生成,请在飞书 Wiki 中编辑正文。 -->
99

10-
[AI Infra Wiki](/wiki/) / [Topic 1 - Kernel and ML Compilers](/wiki/VWJPwVFTHifeadkE4phc45hOntg)
11-
1210
<header class="session-banner wiki-page-banner">
11+
<nav class="wiki-breadcrumb" aria-label="文档路径"><a href="/wiki/">AI Infra Wiki</a><span aria-hidden="true">/</span><a href="/wiki/VWJPwVFTHifeadkE4phc45hOntg">Topic 1 - Kernel and ML Compilers</a></nav>
1312
<span class="section-index">课程资料</span>
1413
<h1>Session 00 | 从 HPC 到 AI Infra: 并行计算与并行编程</h1>
1514
</header>

docs/wiki/WHFXw13vEiD8Hikfp3ScU33JnXe.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@ lastUpdated: false
77

88
<!-- 此文件由 npm run sync:feishu 生成,请在飞书 Wiki 中编辑正文。 -->
99

10-
[AI Infra Wiki](/wiki/) / [Topic 1 - Kernel and ML Compilers](/wiki/VWJPwVFTHifeadkE4phc45hOntg)
11-
1210
<header class="session-banner wiki-page-banner">
11+
<nav class="wiki-breadcrumb" aria-label="文档路径"><a href="/wiki/">AI Infra Wiki</a><span aria-hidden="true">/</span><a href="/wiki/VWJPwVFTHifeadkE4phc45hOntg">Topic 1 - Kernel and ML Compilers</a></nav>
1312
<span class="section-index">课程资料</span>
1413
<h1>Session 01|GPU Programming Model</h1>
1514
</header>

scripts/feishu/render.mjs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,12 @@ export function renderWikiPage({
3333
const breadcrumb = breadcrumbItems
3434
.map(
3535
({ title: itemTitle, route }) =>
36-
`[${escapeMarkdownInline(singleLine(itemTitle))}](${route})`
36+
`<a href="${escapeHtml(route)}">${escapeHtml(singleLine(itemTitle))}</a>`
3737
)
38-
.join(' / ')
39-
const breadcrumbBlock = breadcrumb ? `${breadcrumb}\n\n` : ''
38+
.join('<span aria-hidden="true">/</span>')
39+
const breadcrumbBlock = breadcrumb
40+
? ` <nav class="wiki-breadcrumb" aria-label="文档路径">${breadcrumb}</nav>\n`
41+
: ''
4042
const trimmedBody = body.trim()
4143
const bodyBlock = trimmedBody ? `\n\n${trimmedBody}` : ''
4244

@@ -49,8 +51,8 @@ lastUpdated: false
4951
5052
<!-- 此文件由 npm run sync:feishu 生成,请在飞书 Wiki 中编辑正文。 -->
5153
52-
${breadcrumbBlock}<header class="session-banner wiki-page-banner">
53-
<span class="section-index">课程资料</span>
54+
<header class="session-banner wiki-page-banner">
55+
${breadcrumbBlock} <span class="section-index">课程资料</span>
5456
<h1>${escapeHtml(safeTitle)}</h1>
5557
</header>${bodyBlock}
5658
`
@@ -60,10 +62,6 @@ function singleLine(value) {
6062
return String(value).replace(/[\u0000-\u001f\u007f]+/g, ' ').trim()
6163
}
6264

63-
function escapeMarkdownInline(value) {
64-
return String(value).replace(/[\\`*_[\]<>]/g, '\\$&')
65-
}
66-
6765
function escapeHtml(value) {
6866
return String(value)
6967
.replaceAll('&', '&amp;')

scripts/feishu/render.test.mjs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,20 @@ test('renders Wiki pages with the shared title banner and no Feishu source link'
1111
})
1212

1313
assert.match(output, /<header class="session-banner wiki-page-banner">/)
14+
assert.match(
15+
output,
16+
/<nav class="wiki-breadcrumb" aria-label=""><a href="\/wiki\/"> Wiki<\/a><span aria-hidden="true">\/<\/span><a href="\/wiki\/topic-1"><\/a><\/nav>/
17+
)
1418
assert.match(output, /<span class="section-index"><\/span>/)
1519
assert.match(output, /<h1>GPU &lt;&gt; &amp; <\/h1>/)
16-
assert.match(output, /\[ Wiki\]\(\/wiki\/\) \/ \[\]\(\/wiki\/topic-1\)/)
20+
assert.ok(
21+
output.indexOf('<nav class="wiki-breadcrumb"') >
22+
output.indexOf('<header class="session-banner wiki-page-banner">')
23+
)
24+
assert.ok(
25+
output.indexOf('<nav class="wiki-breadcrumb"') <
26+
output.indexOf('<span class="section-index">课程资料</span>')
27+
)
1728
assert.doesNotMatch(output, //)
1829
assert.doesNotMatch(output, /^# GPU/m)
1930
})
@@ -25,7 +36,7 @@ test('does not add a self-referencing breadcrumb to the Wiki root page', () => {
2536
collectionTitle: '课程 Wiki'
2637
})
2738

28-
assert.doesNotMatch(output, /\[ Wiki\]\(\/wiki\/\)/)
39+
assert.doesNotMatch(output, /class="wiki-breadcrumb"/)
2940
})
3041

3142
test('ends an empty Wiki page without extra blank lines', () => {

0 commit comments

Comments
 (0)