mirror of
https://github.com/veeso/termscp.git
synced 2026-06-12 19:49:49 +02:00
docs: scaffold en-US mdbook
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -31,3 +31,4 @@ dist/build/macos/openssl/
|
||||
|
||||
# brainstorming visual companion
|
||||
.superpowers/
|
||||
docs/*/book/
|
||||
|
||||
22
docs/en-US/book.toml
Normal file
22
docs/en-US/book.toml
Normal file
@@ -0,0 +1,22 @@
|
||||
[book]
|
||||
title = "termscp"
|
||||
description = "A feature rich terminal UI file transfer and explorer with support for SCP/SFTP/FTP/Kube/S3/SMB/WebDAV"
|
||||
authors = ["Christian Visintin"]
|
||||
language = "en"
|
||||
src = "."
|
||||
|
||||
[output.html]
|
||||
default-theme = "light"
|
||||
preferred-dark-theme = "navy"
|
||||
git-repository-url = "https://github.com/veeso/termscp"
|
||||
edit-url-template = "https://github.com/veeso/termscp/edit/main/docs/en-US/{path}"
|
||||
additional-js = ["lang-switcher.js", "mermaid.min.js", "mermaid-init.js"]
|
||||
|
||||
[output.html.fold]
|
||||
enable = true
|
||||
level = 1
|
||||
|
||||
[preprocessor]
|
||||
|
||||
[preprocessor.mermaid]
|
||||
command = "mdbook-mermaid"
|
||||
3
docs/en-US/index.md
Normal file
3
docs/en-US/index.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# termscp
|
||||
|
||||
Placeholder.
|
||||
47
docs/en-US/lang-switcher.js
Normal file
47
docs/en-US/lang-switcher.js
Normal file
@@ -0,0 +1,47 @@
|
||||
// Injects a language toggle (EN / 中文) into the mdBook menu bar.
|
||||
// Swaps the leading /en-US/ <-> /zh-CN/ path segment, preserving the
|
||||
// rest of the path; falls back to the language root on 404 navigation.
|
||||
(function () {
|
||||
const LANGS = [
|
||||
{ code: "en-US", label: "EN" },
|
||||
{ code: "zh-CN", label: "中文" },
|
||||
];
|
||||
|
||||
function currentLang() {
|
||||
const m = window.location.pathname.match(/\/(en-US|zh-CN)\//);
|
||||
return m ? m[1] : "en-US";
|
||||
}
|
||||
|
||||
function swapTo(code) {
|
||||
const path = window.location.pathname;
|
||||
const cur = currentLang();
|
||||
if (path.includes(`/${cur}/`)) {
|
||||
return path.replace(`/${cur}/`, `/${code}/`);
|
||||
}
|
||||
return `/${code}/`;
|
||||
}
|
||||
|
||||
function build() {
|
||||
const right = document.querySelector(".right-buttons");
|
||||
if (!right) return;
|
||||
const cur = currentLang();
|
||||
const wrap = document.createElement("div");
|
||||
wrap.className = "lang-switcher";
|
||||
wrap.style.display = "inline-flex";
|
||||
wrap.style.gap = "0.5rem";
|
||||
wrap.style.marginInlineStart = "0.5rem";
|
||||
LANGS.forEach((l) => {
|
||||
const a = document.createElement("a");
|
||||
a.textContent = l.label;
|
||||
a.href = swapTo(l.code);
|
||||
a.title = l.code;
|
||||
a.setAttribute("aria-current", l.code === cur ? "true" : "false");
|
||||
if (l.code === cur) a.style.fontWeight = "bold";
|
||||
wrap.appendChild(a);
|
||||
});
|
||||
right.appendChild(wrap);
|
||||
}
|
||||
|
||||
if (document.readyState !== "loading") build();
|
||||
else document.addEventListener("DOMContentLoaded", build);
|
||||
})();
|
||||
39
docs/en-US/mermaid-init.js
Normal file
39
docs/en-US/mermaid-init.js
Normal file
@@ -0,0 +1,39 @@
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
(() => {
|
||||
const darkThemes = ['ayu', 'navy', 'coal'];
|
||||
const lightThemes = ['light', 'rust'];
|
||||
|
||||
const classList = document.getElementsByTagName('html')[0].classList;
|
||||
|
||||
let lastThemeWasLight = true;
|
||||
for (const cssClass of classList) {
|
||||
if (darkThemes.includes(cssClass)) {
|
||||
lastThemeWasLight = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
const theme = lastThemeWasLight ? 'default' : 'dark';
|
||||
mermaid.initialize({ startOnLoad: true, theme });
|
||||
|
||||
// Simplest way to make mermaid re-render the diagrams in the new theme is via refreshing the page
|
||||
|
||||
for (const darkTheme of darkThemes) {
|
||||
document.getElementById(darkTheme).addEventListener('click', () => {
|
||||
if (lastThemeWasLight) {
|
||||
window.location.reload();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
for (const lightTheme of lightThemes) {
|
||||
document.getElementById(lightTheme).addEventListener('click', () => {
|
||||
if (!lastThemeWasLight) {
|
||||
window.location.reload();
|
||||
}
|
||||
});
|
||||
}
|
||||
})();
|
||||
2609
docs/en-US/mermaid.min.js
vendored
Normal file
2609
docs/en-US/mermaid.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
13
docs/en-US/theme/head.hbs
Normal file
13
docs/en-US/theme/head.hbs
Normal file
@@ -0,0 +1,13 @@
|
||||
<link rel="icon" type="image/x-icon" href="/shared/favicon.ico">
|
||||
<link rel="icon" type="image/svg+xml" href="/shared/termscp.svg">
|
||||
|
||||
<meta property="og:title" content="{{#if chapter_title}}{{ chapter_title }} · {{/if}}{{ book_title }}">
|
||||
<meta property="og:description" content="A feature rich terminal UI file transfer and explorer with support for SCP/SFTP/FTP/Kube/S3/SMB/WebDAV">
|
||||
<meta property="og:image" content="https://docs.termscp.rs/og_preview.jpg">
|
||||
<meta property="og:url" content="https://docs.termscp.rs/">
|
||||
<meta property="og:type" content="website">
|
||||
|
||||
<meta name="twitter:card" content="summary_large_image">
|
||||
<meta name="twitter:title" content="{{#if chapter_title}}{{ chapter_title }} · {{/if}}{{ book_title }}">
|
||||
<meta name="twitter:description" content="A feature rich terminal UI file transfer and explorer with support for SCP/SFTP/FTP/Kube/S3/SMB/WebDAV">
|
||||
<meta name="twitter:image" content="https://docs.termscp.rs/og_preview.jpg">
|
||||
Reference in New Issue
Block a user