Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Refer to 'ceresdb/doc' for better language switch #5

Merged
merged 1 commit into from
Mar 7, 2023
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
16 changes: 11 additions & 5 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: write
contents: read
pages: write
id-token: write

Expand All @@ -32,14 +32,20 @@ jobs:
uses: peaceiris/actions-mdbook@v1
with:
mdbook-version: 'latest'
- name: Cache Rust Dependencies
uses: actions/cache@v3
with:
path: |
~/.cargo
key: docs-${{ runner.os }}
- name: Install mdBook & mdBook-i18n
run: ./scripts/install.sh
- name: Build docs
run: mdbook build ./docs/en && mdbook build ./docs/zh
- name: Build agg
run: mv ./docs/en/book ./docs/agg/en && mv ./docs/zh/book ./docs/agg/zh
run: sed -i 's|var basePath = "/";|var basePath = "/holoinsight-docs/";|' ./docs/theme/index.hbs && ./scripts/build.sh
- name: Upload docs
uses: actions/upload-pages-artifact@v1
with:
path: ./docs/agg
path: ./docs/book/html
deploy-docs:
environment:
name: github-pages
Expand Down
34 changes: 17 additions & 17 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
# README

# Install mdBook
# Install mdBook & mdBook-i18n

Download mdBook from its [release page](https://github.com/rust-lang/mdBook/releases) and put it on your `$PATH`.
You should install `Rust lang` first.

Verify mdBook:
```bash
mdbook --version
```
Check [this doc](https://www.rust-lang.org/learn/get-started).

output:
```text
mdbook v0.4.26
Then install mdBook & mdBook-i18n using `cargo`:

```bash
./scripts/install.sh
```

Read [mdBook Documentation](https://rust-lang.github.io/mdBook/format/summary.html)
Read [mdBook Documentation](https://rust-lang.github.io/mdBook/format/summary.html) for more details.

# Write documentations

Directory structure:
```text
docs/
en/ English translation
src/
book/ -> Build book result, ignored by git
src/
en/ -> English translation
introduction/
introduction.md A documentation
SUMMARY.md A markdown which generates the sidebar menu. Check the detail here https://rust-lang.github.io/mdBook/format/summary.html
zh/ Chinese translation, has same directory structure as en/
introduction.md -> A markdown
SUMMARY.md -> A markdown which generates the sidebar menu. Check the detail here https://rust-lang.github.io/mdBook/format/summary.html
cn/ -> Chinese translation. It has same directory structure as 'en/'.
resources/ -> Static resources
```

The 'mdbook serve' command is used to preview a book by serving it via HTTP at `localhost:3000` by default:
The './scripts/serve.sh' command is used to preview a book by serving it via HTTP at `localhost:3000` by default:
```bash
mdbook serve ./docs/en
./scripts/serve.sh
```
35 changes: 17 additions & 18 deletions docs/README_CN.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,34 @@
# README

# 安装 mdBook
# 安装 mdBook 和 mdBook-i18n

从 [release page](https://github.com/rust-lang/mdBook/releases) 下载 mdBook,并将其放置在 `$PATH` 下.
你需要先安装 Rust 语言.

验证 mdBook:
```bash
mdbook --version
```
请参考这个文档 [this doc](https://www.rust-lang.org/learn/get-started).

输出:
```text
mdbook v0.4.26
使用 `cargo` 安装 mdBook 和 mdBook-i18n:

```bash
./scripts/install.sh
```

阅读 [mdBook 文档](https://rust-lang.github.io/mdBook/format/summary.html)
更多详情请阅读 [mdBook 文档](https://rust-lang.github.io/mdBook/format/summary.html)

# 编写文档

目录结构:
```text
docs/
en/ 英文翻译
src/
introduction/
introduction.md 一个文档
SUMMARY.md 一个 markdown 文档,用于生成侧边菜单栏. 详情请参考 mdBook 文档。
zh/ 中文翻译,与 en/ 有相同的目录结构。
book/ -> 书的构建结果,会被 git 忽略
src/
en/ 英文翻译
introduction/
introduction.md -> 一个文档
SUMMARY.md -> 一个 markdown 文档,用于生成侧边菜单栏. 详情请参考 mdBook 文档。
cn/ -> 中文翻译,与 en/ 有相同的目录结构。
```

使用 'mdbook serve' 命令在 `localhost:3000` 部署一个 HTTP 服务器用于预览渲染结果。
使用 './scripts/serve.sh' 命令在 `localhost:3000` 部署一个 HTTP 服务器用于预览渲染结果。
```bash
mdbook serve ./docs/en
./scripts/serve.sh
```
23 changes: 0 additions & 23 deletions docs/agg/index.html

This file was deleted.

29 changes: 29 additions & 0 deletions docs/book.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[book]
title = "HoloInsight Documentation"
authors = ["HoloInsight Authors"]
src = "src/en"
language = "en"
multilingual = true

[build]
use-default-preprocessors = false


[preprocessor.links]

[[output.i18n.translations]]
src = "src/cn"
language = "cn"
translators = ["HoloInsight Authors"]
title = "HoloInsight 文档"

[output.random]
command = "/bin/bash ../../move.sh"

[output.html]
site-url = "/holoinsight-docs/"
additional-css = ["style.css"]
additional-js = ["sidebar.js"]

[output.html.fold]
enable = true
8 changes: 0 additions & 8 deletions docs/en/book.toml

This file was deleted.

8 changes: 8 additions & 0 deletions docs/move.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -e

echo "ready to move files"
cp -r ../i18n/cn ../html/cn
cp -r ../i18n/en ../html/en
cp -r ../../src/resources ../../book/html/resources
echo "copy done"
66 changes: 66 additions & 0 deletions docs/sidebar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// Un-active everything when you click it
Array.prototype.forEach.call(document.getElementsByClassName("pagetoc")[0].children, function(el) {
el.addEventHandler("click", function() {
Array.prototype.forEach.call(document.getElementsByClassName("pagetoc")[0].children, function(el) {
el.classList.remove("active");
});
el.classList.add("active");
});
});

var updateFunction = function() {

var id;
var elements = document.getElementsByClassName("header");
Array.prototype.forEach.call(elements, function(el) {
if (window.pageYOffset >= el.offsetTop) {
id = el;
}
});

Array.prototype.forEach.call(document.getElementsByClassName("pagetoc")[0].children, function(el) {
el.classList.remove("active");
});

Array.prototype.forEach.call(document.getElementsByClassName("pagetoc")[0].children, function(el) {
if (id.href.localeCompare(el.href) == 0) {
el.classList.add("active");
}
});
};

// Populate sidebar on load
window.addEventListener('load', function() {
var pagetoc = document.getElementsByClassName("pagetoc")[0];
var elements = document.getElementsByClassName("header");
Array.prototype.forEach.call(elements, function(el) {
var link = document.createElement("a");

// Indent shows hierarchy
var indent = "";
switch (el.parentElement.tagName) {
case "H2":
indent = "20px";
break;
case "H3":
indent = "40px";
break;
case "H4":
indent = "60px";
break;
default:
break;
}

link.appendChild(document.createTextNode(el.text));
link.style.paddingLeft = indent;
link.href = el.href;
pagetoc.appendChild(link);
});
updateFunction.call();
});



// Handle active elements on scroll
window.addEventListener("scroll", updateFunction);
File renamed without changes.
11 changes: 11 additions & 0 deletions docs/src/cn/introduction/what-is-holoinsight.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
![HoloInsight](https://github.com/traas-stack/holoinsight/raw/main/docs/logo/logo.png)

![License](https://img.shields.io/badge/license-Apache--2.0-green.svg)
[![OpenIssue](https://img.shields.io/github/issues/traas-stack/holoinsight)](https://github.com/CeresDB/ceresdb/issues)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue address incorrectly points to repo CeresDB.


# 什么是 HoloInsight

HoloInsight 关联项目:
* <a href="https://github.com/traas-stack/holoinsight" target="_blank">HoloInsight</a>
* <a href="https://github.com/traas-stack/holoinsight-agent" target="_blank">HoloInsight Agent</a>
* <a href="https://github.com/traas-stack/holoinsight-docs" target="_blank">HoloInsight Docs</a>
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
![HoloInsight](https://github.com/traas-stack/holoinsight/raw/main/docs/logo/logo.png)

![License](https://img.shields.io/badge/license-Apache--2.0-green.svg)
[![OpenIssue](https://img.shields.io/github/issues/traas-stack/holoinsight)](https://github.com/CeresDB/ceresdb/issues)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue address incorrectly points to repo CeresDB.


# What is HoloInsight
HoloInsight is a cloud-native observability platform with a special focus on real-time log analysis and AI integration. You can check the following documentation for more information.

Expand Down
48 changes: 48 additions & 0 deletions docs/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
@media only screen and (max-width:1439px) {
.sidetoc {
display: none;
}
}

@media only screen and (min-width:1440px) {
main {
position: relative;
}
.sidetoc {
margin-left: auto;
margin-right: auto;
left: calc(100% + (var(--content-max-width))/4 - 140px);
position: absolute;
}
.pagetoc {
position: fixed;
width: 200px;
height: calc(100vh - var(--menu-bar-height) - 0.67em * 4);
overflow: auto;
}
.pagetoc a {
border-left: 1px solid var(--sidebar-bg);
color: var(--fg) !important;
display: block;
padding-bottom: 5px;
padding-top: 5px;
padding-left: 10px;
text-align: left;
text-decoration: none;
}
.pagetoc a:hover,
.pagetoc a.active {
background: var(--sidebar-bg);
color: var(--sidebar-fg) !important;
}
.pagetoc .active {
background: var(--sidebar-bg);
color: var(--sidebar-fg);
}
}

@media print {
.sidetoc {
display: none;
}
}
Loading