Skip to content

Commit a8a36fb

Browse files
committed
feat: Updated assets and added script to download updates.
1 parent 8558114 commit a8a36fb

17 files changed

+2054
-53
lines changed

.editorconfig

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 4
6+
end_of_line = lf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
10+
11+
[*.sh]
12+
indent_size = 2
13+
14+
[*.{css,js,json}]
15+
indent_size = 2
16+
17+
[*.{yml,yaml}]
18+
indent_size = 2

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/docker-compose.yml
2+
/docroot
3+
tmp
4+
Dockerfile.*
5+
.idea
6+
.vscode

bin/assets.json

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
{
2+
"assets": [
3+
{
4+
"asset": "js/docsify.min.js",
5+
"source": "https://cdn.jsdelivr.net/npm/docsify@4",
6+
"info": "https://docsify.js.org/#/quickstart"
7+
},
8+
{
9+
"asset": "js/docsify-themeable.min.js",
10+
"source": "https://cdn.jsdelivr.net/npm/docsify-themeable@0/dist/js/docsify-themeable.min.js",
11+
"info": "https://jhildenbiddle.github.io/docsify-themeable/#/quick-start"
12+
},
13+
{
14+
"asset": "js/mermaid.min.js",
15+
"source": "https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.min.js"
16+
},
17+
{
18+
"asset": "js/plugins/code-inline.min.js",
19+
"source": "https://unpkg.com/@rakutentech/docsify-code-inline/dist/index.min.js",
20+
"info": "https://www.npmjs.com/package/@rakutentech/docsify-code-inline"
21+
},
22+
{
23+
"asset": "js/plugins/docsify-copy-code.min.js",
24+
"source": "https://cdn.jsdelivr.net/npm/docsify-copy-code/dist/docsify-copy-code.min.js"
25+
},
26+
{
27+
"asset": "js/plugins/docsify-mermaid.min.js",
28+
"source": "https://unpkg.com/[email protected]/dist/docsify-mermaid.js",
29+
"info": "https://github.com/Leward/mermaid-docsify"
30+
},
31+
{
32+
"asset": "js/plugins/search.min.js",
33+
"source": "https://cdn.jsdelivr.net/npm/docsify/lib/plugins/search.min.js"
34+
},
35+
{
36+
"asset": "css/docsify4-themes-vue.css",
37+
"source": "https://cdn.jsdelivr.net/npm/docsify@4/themes/vue.css"
38+
},
39+
{
40+
"asset": "css/themeable-simple.css",
41+
"source": "https://cdn.jsdelivr.net/npm/docsify-themeable@0/dist/css/theme-simple.css"
42+
},
43+
{
44+
"asset": "css/themeable-simple-dark.css",
45+
"source": "https://cdn.jsdelivr.net/npm/docsify-themeable@0/dist/css/theme-simple-dark.css"
46+
}
47+
],
48+
"prism": {
49+
"asset": "js/prism/*",
50+
"source": "https://raw.githubusercontent.com/PrismJS/prism/v1.29.0/components/*",
51+
"supports": [
52+
"prism-bash.min.js",
53+
"prism-diff.min.js",
54+
"prism-docker.min.js",
55+
"prism-git.min.js",
56+
"prism-groovy.min.js",
57+
"prism-ignore.min.js",
58+
"prism-ini.min.js",
59+
"prism-json.min.js",
60+
"prism-makefile.min.js",
61+
"prism-php.min.js",
62+
"prism-regex.min.js",
63+
"prism-scss.min.js",
64+
"prism-sql.min.js",
65+
"prism-typescript.min.js",
66+
"prism-yaml.min.js"
67+
]
68+
}
69+
}

bin/download-assets.php

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env php
2+
<?php
3+
4+
$assetsDir = __DIR__ . '/../html/assets';
5+
$json = file_get_contents(__DIR__ . '/assets.json');
6+
$assets = json_decode($json, true);
7+
8+
$sources = $assets['assets'];
9+
echo "\nFound " . count($sources) . " docsify assets to download.";
10+
echo "\nFound " . count($assets['prism']['supports']) . " prism.js language packs to download.";
11+
12+
foreach ($assets['prism']['supports'] as $name) {
13+
$sources[] = [
14+
'asset' => str_replace('*', $name, $assets['prism']['asset']),
15+
'source' => str_replace('*', $name, $assets['prism']['source']),
16+
];
17+
}
18+
19+
echo "\n\nDownloading...\n";
20+
21+
foreach ($sources as $source) {
22+
if (! $script = file_get_contents($source['source'])) {
23+
echo " FAILED to download {$source['asset']}\n";
24+
continue;
25+
}
26+
27+
$status = file_put_contents("{$assetsDir}/{$source['asset']}", $script)
28+
? 'saved'
29+
: 'FAILED to save';
30+
echo " {$status} {$source['asset']}\n";
31+
}
32+
33+
echo "Done.\n";
34+
exit(0);
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
:root {
2+
--content-max-width: 84em;
3+
--link-color: var(--theme-color);
4+
--code-inline-color: #e96900;
5+
}
6+
@media (prefers-color-scheme: dark) {
7+
:root {
8+
--code-inline-background: #0e2233;
9+
}
10+
}
11+
@media (prefers-color-scheme: light) {
12+
:root {
13+
--code-inline-background: #f8f8f8;
14+
}
15+
}
16+
17+
.mermaid {
18+
background-color: #fff;
19+
}

html/assets/css/themeable-simple-dark.css

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

html/assets/css/themeable-simple.css

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

html/assets/docs/README.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Docsify docker image
2+
3+
## About
4+
5+
This is docker image to fast start with [docsify](https://docsify.js.org/) markdown docs viewer.
6+
7+
It's based on [nginx docker image](https://hub.docker.com/_/nginx).
8+
9+
### Included Plugins
10+
11+
- [search](https://docsify.js.org/#/plugins?id=full-text-search) - a docsify full text search plugin.
12+
- [mermaid-docsify](https://github.com/Leward/mermaid-docsify) - a docsify plugin which allows to render mermaid diagrams in docsify.
13+
- [docsify-copy-code](https://github.com/jperasmus/docsify-copy-code) - a docsify plugin that adds a button to easily copy code blocks to your clipboard.
14+
15+
## Quick start
16+
17+
Just launch the container to see it in action
18+
19+
```
20+
docker run --name docsify-example -d -p 8080:80 justcoded/docsify:latest
21+
```
22+
23+
Access the demo page on [127.0.0.1:8080](http://127.0.0.1:8080).
24+
25+
## Display your docs
26+
27+
Just mount your docs folder to `/usr/share/nginx/html/docs`.
28+
29+
Special files you may want to create:
30+
31+
- `_sidebar.md` - Left nav
32+
- `_navbar.md` - Top nav
33+
34+
## Docker compose example
35+
36+
```yaml
37+
---
38+
version: "3.7"
39+
services:
40+
docsify:
41+
image: justcoded/docsify:latest
42+
volumes:
43+
- ./docs/:/usr/share/nginx/html/docs
44+
ports:
45+
- 8080:80
46+
```
47+
48+
## Configurations
49+
50+
### Custom docsify config
51+
52+
If you want custom config you can override `/usr/share/nginx/html/assets/docsify.conf.js`
53+
with your mounted file.
54+
55+
Alternatively, you can set env variable with json to override the config:
56+
57+
```yaml
58+
...
59+
environment:
60+
OPT_DOCSIFY_CONF: "{subMaxLevel: 3}"
61+
```
62+
63+
### Custom page title
64+
65+
To specify custom page title on page load you can use env variable:
66+
67+
```yaml
68+
...
69+
environment:
70+
OPT_INDEX_TITLE: My custom page title
71+
```

html/assets/docs/_navbar.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* [Home](/)

html/assets/docs/_sidebar.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* [Getting Started](/)

0 commit comments

Comments
 (0)