Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion templates/modern/layout/_master.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
{{/_disableToc}}

{{^_disableBreadcrumb}}
<nav id="breadcrumb"></nav>
<nav id="breadcrumb"><ol class="breadcrumb"><li class="breadcrumb-item">&nbsp;</li></ol></nav>
{{/_disableBreadcrumb}}
</div>

Expand Down
16 changes: 16 additions & 0 deletions templates/modern/src/highlight.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,22 @@
@include meta.load-css("highlight.js/scss/vs2015");
}

/* default code block style before hljs loads */
pre code {
background-color: #f5f5f5;
color: #000;
display: block;
overflow-x: auto;
padding: 1em;
}

@include bootstrap.color-mode(dark) {
pre code {
background: #1E1E1E;
color: #DCDCDC;
}
}

.hljs {
background-color: #f5f5f5;

Expand Down
2 changes: 1 addition & 1 deletion templates/modern/src/highlight.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export async function highlight() {
const { configureHljs } = await options()
configureHljs?.(hljs)

document.querySelectorAll('pre code').forEach(block => {
codeBlocks.forEach(block => {
hljs.highlightElement(block as HTMLElement)
})

Expand Down
12 changes: 7 additions & 5 deletions templates/modern/src/nav.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,15 @@ export async function renderNavbar(): Promise<NavItem[]> {
}

export function renderBreadcrumb(breadcrumb: (NavItem | TocNode)[]) {
const container = document.getElementById('breadcrumb')
if (breadcrumb.length === 0) {
return
}

const container = document.querySelector<HTMLOListElement>('#breadcrumb .breadcrumb')
if (container) {
container.innerHTML = ''
render(
html`
<ol class="breadcrumb">
${breadcrumb.map(i => html`<li class="breadcrumb-item"><a href="${i.href}">${breakWordLit(i.name)}</a></li>`)}
</ol>`,
breadcrumb.map(i => html`<li class="breadcrumb-item"><a href="${i.href}">${breakWordLit(i.name)}</a></li>`),
container)
}
}
Expand Down