Skip to content
Merged
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
3 changes: 2 additions & 1 deletion docs/docfx.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
"_appTitle": "docfx",
"_appName": "docfx",
"_appFooter": "<span>Supported by the <a href=\"https://dotnetfoundation.org\">.NET Foundation</a>. Made with <a href=\"https://dotnet.github.io/docfx\">docfx</a></span>",
"_googleAnalyticsTagId": "G-Q5N6XJHEX5"
"_googleAnalyticsTagId": "G-Q5N6XJHEX5",
"pdf": true
},
"markdownEngineProperties": {
"alerts": {
Expand Down
3 changes: 2 additions & 1 deletion templates/default(zh-cn)/token.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,6 @@
"themeDark": "夜晚",
"themeAuto": "自动",
"changeTheme": "切换主题",
"copy": "复制"
"copy": "复制",
"downloadPdf": "下载 PDF"
}
3 changes: 2 additions & 1 deletion templates/default/token.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,6 @@
"themeDark": "Dark",
"themeAuto": "Auto",
"changeTheme": "Change theme",
"copy": "Copy"
"copy": "Copy",
"downloadPdf": "Download PDF"
}
3 changes: 2 additions & 1 deletion templates/modern/layout/_master.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
<meta name="loc:themeAuto" content="{{__global.themeAuto}}">
<meta name="loc:changeTheme" content="{{__global.changeTheme}}">
<meta name="loc:copy" content="{{__global.copy}}">
<meta name="loc:downloadPdf" content="{{__global.downloadPdf}}">
{{/redirect_url}}
</head>

Expand Down Expand Up @@ -135,7 +136,7 @@
<div class="container-xxl search-results" id="search-results"></div>
{{/_enableSearch}}

<footer class="border-top">
<footer class="border-top text-secondary">
<div class="container-xxl">
<div class="flex-fill">
{{{_appFooter}}}{{^_appFooter}}<span>Made with <a href="https://dotnet.github.io/docfx">docfx</a></span>{{/_appFooter}}
Expand Down
16 changes: 13 additions & 3 deletions templates/modern/src/layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
$header-height: 60px;
$footer-height: 60px;
$main-padding-top: 1.6rem;
$main-padding-bottom: 4rem;
$main-padding-bottom: 2rem;

// Makes a div sticky to top
@mixin sticky-top {
Expand Down Expand Up @@ -53,6 +53,7 @@ body[data-layout="landing"] {
}

>footer {
font-size: 14px;
padding: 1rem 0;
height: $footer-height;

Expand Down Expand Up @@ -121,8 +122,7 @@ body[data-layout="landing"] {
>.toc-offcanvas {
flex: .35;
display: block;
overflow-x: hidden;
overflow-y: auto;
overflow: hidden;
max-width: 360px;
max-height: calc(100vh - $header-height - $main-padding-top);

Expand All @@ -131,9 +131,15 @@ body[data-layout="landing"] {
@include media-breakpoint-down(md) {
flex: 0;
}

.offcanvas-start, .offcanvas-body {
height: 100%;
}
}

>.content {
display: flex;
flex-direction: column;
flex: 1;
min-width: 0;
margin: 0 3rem;
Expand All @@ -146,6 +152,10 @@ body[data-layout="landing"] {
min-height: 40px;
}

article {
flex: 1;
}

>.contribution,
>.next-article {
display: flex;
Expand Down
16 changes: 15 additions & 1 deletion templates/modern/src/toc.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ $expand-stub-width: .85rem;
.toc {
min-width: 0;
width: 100%;
height: 100%;
display: flex;
flex-direction: column;

ul {
font-size: 14px;
Expand Down Expand Up @@ -72,7 +75,7 @@ $expand-stub-width: .85rem;
display: flex;
position: relative;
align-items: center;
margin-bottom: 1rem;
margin-bottom: .5rem;

>i.bi {
position: absolute;
Expand All @@ -89,4 +92,15 @@ $expand-stub-width: .85rem;
font-size: .9em;
color: $secondary;
}

a.pdf-link {
@include underline-on-hover;

&::before {
content: "\F756";
display: inline-block;

@include adjust-icon;
}
}
}
11 changes: 9 additions & 2 deletions templates/modern/src/toc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export async function renderToc(): Promise<TocNode[]> {
const disableTocFilter = meta('docfx:disabletocfilter') === 'true'

const tocUrl = new URL(tocrel.replace(/.html$/gi, '.json'), window.location.href)
const { items } = await (await fetch(tocUrl)).json()
const { items, pdf, pdfFileName } = await (await fetch(tocUrl)).json()

const tocFilterUrl = disableTocFilter ? '' : (localStorage?.getItem('tocFilterUrl') || '')
let tocFilter = disableTocFilter ? '' : (localStorage?.getItem('tocFilter') || '')
Expand Down Expand Up @@ -92,7 +92,10 @@ export async function renderToc(): Promise<TocNode[]> {
}

function renderToc() {
render(html`${renderTocFilter()} ${renderTocNodes(items) || renderNoFilterResult()}`, tocContainer)
render(html`
${renderTocFilter()}
<div class="flex-fill overflow-y-auto">${renderTocNodes(items) || renderNoFilterResult()}</div>
${renderDownloadPdf()}`, tocContainer)
}

function renderTocNodes(nodes: TocNode[]): TemplateResult {
Expand Down Expand Up @@ -150,6 +153,10 @@ export async function renderToc(): Promise<TocNode[]> {
return tocFilter === '' ? null : html`<div class='no-result'>${loc('searchNoResults', { query: tocFilter })}</div>`
}

function renderDownloadPdf(): TemplateResult {
return pdf ? html`<div class="py-2 mb-md-4"><a class="pdf-link" href="${pdfFileName || 'toc.pdf'}">${loc('downloadPdf')}</a></div>` : null
}

function normalizeUrlPath(url: { pathname: string }): string {
return url.pathname.replace(/\/index\.html$/gi, '/')
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1079,6 +1079,7 @@
"themeAuto": "Auto",
"changeTheme": "Change theme",
"copy": "Copy",
"downloadPdf": "Download PDF",
"_shared": {}
},
"yamlmime": "ManagedReference",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,7 @@
"themeAuto": "Auto",
"changeTheme": "Change theme",
"copy": "Copy",
"downloadPdf": "Download PDF",
"_shared": {}
},
"yamlmime": "ManagedReference",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1214,6 +1214,7 @@
"themeAuto": "Auto",
"changeTheme": "Change theme",
"copy": "Copy",
"downloadPdf": "Download PDF",
"_shared": {}
},
"yamlmime": "ManagedReference",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1438,6 +1438,7 @@
"themeAuto": "Auto",
"changeTheme": "Change theme",
"copy": "Copy",
"downloadPdf": "Download PDF",
"_shared": {}
},
"yamlmime": "ManagedReference",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1314,6 +1314,7 @@
"themeAuto": "Auto",
"changeTheme": "Change theme",
"copy": "Copy",
"downloadPdf": "Download PDF",
"_shared": {}
},
"yamlmime": "ManagedReference",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1213,6 +1213,7 @@
"themeAuto": "Auto",
"changeTheme": "Change theme",
"copy": "Copy",
"downloadPdf": "Download PDF",
"_shared": {}
},
"yamlmime": "ManagedReference",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,7 @@
"themeAuto": "Auto",
"changeTheme": "Change theme",
"copy": "Copy",
"downloadPdf": "Download PDF",
"_shared": {}
},
"yamlmime": "ManagedReference",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4227,6 +4227,7 @@
"themeAuto": "Auto",
"changeTheme": "Change theme",
"copy": "Copy",
"downloadPdf": "Download PDF",
"_shared": {}
},
"yamlmime": "ManagedReference",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1214,6 +1214,7 @@
"themeAuto": "Auto",
"changeTheme": "Change theme",
"copy": "Copy",
"downloadPdf": "Download PDF",
"_shared": {}
},
"yamlmime": "ManagedReference",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -903,6 +903,7 @@
"themeAuto": "Auto",
"changeTheme": "Change theme",
"copy": "Copy",
"downloadPdf": "Download PDF",
"_shared": {}
},
"yamlmime": "ManagedReference",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,7 @@
"themeAuto": "Auto",
"changeTheme": "Change theme",
"copy": "Copy",
"downloadPdf": "Download PDF",
"_shared": {}
},
"yamlmime": "ManagedReference",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1347,6 +1347,7 @@
"themeAuto": "Auto",
"changeTheme": "Change theme",
"copy": "Copy",
"downloadPdf": "Download PDF",
"_shared": {}
},
"yamlmime": "ManagedReference",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,7 @@
"themeAuto": "Auto",
"changeTheme": "Change theme",
"copy": "Copy",
"downloadPdf": "Download PDF",
"_shared": {}
},
"yamlmime": "ManagedReference",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,7 @@
"themeAuto": "Auto",
"changeTheme": "Change theme",
"copy": "Copy",
"downloadPdf": "Download PDF",
"_shared": {}
},
"yamlmime": "ManagedReference",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1132,6 +1132,7 @@
"themeAuto": "Auto",
"changeTheme": "Change theme",
"copy": "Copy",
"downloadPdf": "Download PDF",
"_shared": {}
},
"yamlmime": "ManagedReference",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,7 @@
"themeAuto": "Auto",
"changeTheme": "Change theme",
"copy": "Copy",
"downloadPdf": "Download PDF",
"_shared": {}
},
"yamlmime": "ManagedReference",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,7 @@
"themeAuto": "Auto",
"changeTheme": "Change theme",
"copy": "Copy",
"downloadPdf": "Download PDF",
"_shared": {}
},
"yamlmime": "ManagedReference",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1465,6 +1465,7 @@
"themeAuto": "Auto",
"changeTheme": "Change theme",
"copy": "Copy",
"downloadPdf": "Download PDF",
"_shared": {}
},
"yamlmime": "ManagedReference",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1825,6 +1825,7 @@
"themeAuto": "Auto",
"changeTheme": "Change theme",
"copy": "Copy",
"downloadPdf": "Download PDF",
"_shared": {}
},
"yamlmime": "ManagedReference",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1077,6 +1077,7 @@
"themeAuto": "Auto",
"changeTheme": "Change theme",
"copy": "Copy",
"downloadPdf": "Download PDF",
"_shared": {}
},
"yamlmime": "ManagedReference",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,7 @@
"themeAuto": "Auto",
"changeTheme": "Change theme",
"copy": "Copy",
"downloadPdf": "Download PDF",
"_shared": {}
},
"yamlmime": "ManagedReference",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,7 @@
"themeAuto": "Auto",
"changeTheme": "Change theme",
"copy": "Copy",
"downloadPdf": "Download PDF",
"_shared": {}
},
"yamlmime": "ManagedReference",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,7 @@
"themeAuto": "Auto",
"changeTheme": "Change theme",
"copy": "Copy",
"downloadPdf": "Download PDF",
"_shared": {}
},
"yamlmime": "ManagedReference",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,7 @@
"themeAuto": "Auto",
"changeTheme": "Change theme",
"copy": "Copy",
"downloadPdf": "Download PDF",
"_shared": {}
},
"yamlmime": "ManagedReference",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1047,6 +1047,7 @@
"themeAuto": "Auto",
"changeTheme": "Change theme",
"copy": "Copy",
"downloadPdf": "Download PDF",
"_shared": {}
},
"yamlmime": "ManagedReference",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -840,6 +840,7 @@
"themeAuto": "Auto",
"changeTheme": "Change theme",
"copy": "Copy",
"downloadPdf": "Download PDF",
"_shared": {}
},
"yamlmime": "ManagedReference",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -991,6 +991,7 @@
"themeAuto": "Auto",
"changeTheme": "Change theme",
"copy": "Copy",
"downloadPdf": "Download PDF",
"_shared": {}
},
"yamlmime": "ManagedReference",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2235,6 +2235,7 @@
"themeAuto": "Auto",
"changeTheme": "Change theme",
"copy": "Copy",
"downloadPdf": "Download PDF",
"_shared": {}
},
"yamlmime": "ManagedReference",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1231,6 +1231,7 @@
"themeAuto": "Auto",
"changeTheme": "Change theme",
"copy": "Copy",
"downloadPdf": "Download PDF",
"_shared": {}
},
"yamlmime": "ManagedReference",
Expand Down
Loading