$ docker run -it -d --name docsify -p 8003:3000 -v /data/wangjl/test/docsify:/home/tom/docsify node bash
$ docker exec -it docsify bash
root@ce05b2382081:/# node --version
v17.3.0
root@ce05b2382081:/# npm --version
8.3.0
# docsify --version
docsify-cli version:
4.4.4
Init the docs
# cd /home/tom/docsify/
# docsify init docs
check the files
# ls -ltha docs/
total 16K
drwxr-xr-x 2 root root 4.0K Jul 25 07:37 .
drwxrwxr-x 3 1001 1001 4.0K Jul 25 07:37 ..
-rw-r--r-- 1 root root 604 Jul 25 07:37 index.html #入口文件
-rw-r--r-- 1 root root 34 Jul 25 07:34 README.md #会做为主页内容渲染
-rw-r--r-- 1 root root 0 Jul 25 07:34 .nojekyll #用于阻止 GitHub Pages 会忽略掉下划线开头的文件
Start the server on port 3000:
# docsify serve docs
View from broser:
http://IP:8003
Using docsify to view markdown files.
The app has Dockered in dawneve/docsify:4.4.4.
$ docker pull dawneve/docsify:4.4.4
$ docker run -it -d --name docsify -p 8003:3000 -v /home/wangjl/data/project/learnCpp:/home/docsify/learnCpp dawneve/docsify:4.4.4 bash
$ docker exec -it docsify bash
Init the docs
# cd /home/docsify/learnCpp
# docsify init docs
yes.
Start the server on port 3000:
# docsify serve docs
Browser on host:
http://192.168.2.120:8003/#/
$ id #check your uid on host
uid=1001(wangjl) gid=1001(wangjl) groups=1001(wangjl),1004(docker)
I added a user named tom when making this image:
if(0){
# useradd -s /bin/bash -d /home/docsify -m docsify -u 1001
# passwd docsify
# chown -R docsify /home/docsify
}
Change the uid of user tom in the containner to your id on the host as shown above.
# usermod -u 1001 tom
Change owner of these files in the containner
# chown -R tom *
Start the server on port 3000/ host 8003
# docsify serve docs
Then we can:
$ cd docs/
$ vim index.html
<script> window.$docsify = { loadSidebar: true } </script>
$ vim _sidebar.md
* [Chapter 0 Preface](A0/1_readme.md)
* [Chapter 1 Basics](A1/1_readme.md)
* [Chapter 2 Class](A2/1_readme.md)
Control the sub menu shown level:
<script>
window.$docsify = {
loadSidebar: true,
subMaxLevel: 3
}
</script>
Overwrite _sidebar.md in nested folds:
<script>
window.$docsify = {
loadSidebar: true,
alias: {
'/.*/_sidebar.md': '/_sidebar.md',
'/.*/_navbar.md': '/_navbar.md',
}
}
</script>
When the menu are very few, just edit index.html
<body>
<nav>
<a href="#/">项目</a>
<a href="#/home1">home1</a>
<a href="#/bar/a">bar/a</a>
</nav>
</body>
Another better way:
<script>
window.$docsify = {
loadNavbar: true
}
</script>
$ vim _navbar.md
* [Basic](A1/1_readme)
* [Class](A2/1_readme)
* Help
* [README](README)
* [Editing Guid](A0/1_readme)
Default cover is ./README.md, but we can add one.
<script>
window.$docsify = {
coverpage: true
}
</script>
$ vim _coverpage.md

# My C++ docs
## 个人文档网站
> 一个神奇的文档网站生成工具 docsify
* Simple and lightweight (~12kb gzipped)
* Multiple themes
* Not build static html files
[GitHub](https://github.com/DawnEve/learn_C)
[Get Started](/A0/1_readme)
Save css and js to local, prevant loading…… problem.
$ vim index.html
<link rel="stylesheet" href="static/css/vue.css">
<script src="static/js/docsify.min.js"></script>
$ mkdir static
$ mkdir static/css
$ mkdir static/js
Save the css and js files.
$ wget https://cdn.jsdelivr.net/npm/docsify@4/lib/themes/vue.css -O static/css/vue.css
$ wget https://cdn.jsdelivr.net/npm/docsify@4 -O static/js/docsify.min.js
You need to create a
.nojekyllin./docsto prevent GitHub Pages from ignoring files that begin with an underscore.
$ git remote add origin https://github.com/DawnEve/learnCpp.git
http/https 不能用了。
$ git remote add origin git@eve:DawnEve/learnCpp.git
fatal: remote origin already exists.
$ git remote rm origin
I am using multiple username on one machine.
$ git remote add origin git@eve:DawnEve/learnCpp.git
$ git push origin master
Content type
Image
Digest
sha256:7d5a7a929…
Size
359 MB
Last updated
about 4 years ago
docker pull dawneve/docsify:4.4.4