You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/README.md
+71-53Lines changed: 71 additions & 53 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,50 +14,39 @@ If you know what _Docsify_ is and want to start using it immediately, feel free
14
14
15
15
_Note: The instructions in this repo are intended for Linux and macOS environments._
16
16
17
-
18
-
## Why use Docsify for a docs site?
17
+
## Why use _Docsify_?
19
18
20
19
My requirement is to build a docs site with minimal setup to use existing docs directories without restructuring or formatting the docs. I found _Docsify_ is ideal for this.
21
20
22
21
You can use _Docsify_ with its defaults or very simple tweaks, yet get a UI with menus, themes, mobile functionality and a cover page. And page loads are seamless in the shell as it is a SPA. These things that take more effort and code changes or additions if you want to do them with static-site generators. _Docsify_ also documentation as its main purpose, unlike some other tools.
23
22
24
23

25
24
26
-
## Docsify basics
25
+
## _Docsify_ basics
27
26
28
27
A _Docsify_ doc site works works _without_ the need to edit your existing docs and _without_ building any HTML pages. The rendering is done on the client-side in a single page application, running on _index.html_.
29
28
30
-
Files needed to build a docs site with _Docsify_:
31
-
32
-
-**cover page** - Optional landing page with background color or image and some minimal text.
33
-
-**homepage** - First page that a user sees, after the cover page.
34
-
-**sidebar** - Describes your menu layout. As _Docsify_ is not aware of directory structure so it may not function as you hope without this file.
35
-
-**index page** - Base of the app. This will setup the app using the _Docsify_ library, set a theme and apply other configurations.
29
+
### Structure
36
30
37
-
Once you have that setup in _docs_ directory and have pushed to Github, you can setup Github Pages serving the _docs_ directory. Note: _Docsify_also works with _Netlify_ as per their docs, but this project just considers the Github Pages case.
31
+
Main components of a _Docsify_site.
38
32
39
-
## Get a local copy of this repo
33
+
-**cover page** - Optional. Landing page with background color or image and some minimal text.
34
+
-**homepage** - First page that a user sees, after the cover page. This is a content page written in markdown and it could be the only page of your site if you like.
35
+
-**index page** - HTML file base of the app. This includes JS and CSS calls for setting up and styling the _Docsify_ app. Plus JS code which you set to customize the app.
36
+
-**sidebar** - Optional. Describes the menu layout for the left sidebar, using custom ordering and nested structure. _Docsify_ is not aware of directory structure, so this is where you get to define your menu. Alternatively, let _Docsify_ create the menu bar based on the structure of your homepage (_docs/README.md) file - this works best if you only have a single content markdown page or a _navbar_ (top of the screen) to switch between sections.
37
+
-**navbar** - Optional. Describes the menu layout for the top right menu.
Once you have that setup in _docs_ directory and have pushed to Github, you can setup Github Pages serving the _docs_ directory. Note: _Docsify_ also works with _Netlify_ as per their docs, but this project just considers the Github Pages case.
51
40
52
-
##Doc links
41
+
### Linking to pages
53
42
54
43
Instructions for creating valid Docsify links in your markdown files.
55
44
56
45
The _Docsify_ site is served from the `docs` directory with restrictions on links between files. Therefore you must ensure your markdown files (including the [sidebar](#sidebar)) are valid.
57
46
58
47
As usual external resource can be linked e.g. `https://example.com`.
59
48
60
-
## Rules for internal links
49
+
**Rules for internal links**
61
50
62
51
Apply these rules to the latter part of markdown URLs such as `[Text](page.md)`.
63
52
@@ -72,46 +61,65 @@ Apply these rules to the latter part of markdown URLs such as `[Text](page.md)`.
72
61
- Do not reference the `docs` directory in the path. e.g. `/docs/foo.md`
73
62
- Do not refer to content outside of the `docs` directory. e.g. `../README.md`
74
63
64
+
## Serve a _Docsify_ site locally
75
65
76
-
## Quickstart local server
77
-
78
-
Follow these steps to setup and run a Docsify project locally.
66
+
Start running a local server to preview a _Docsify_ site. Choose an option below.
79
67
80
-
### 1. Install
81
-
82
-
Clone this repo to your machine - see the [steps](#get-a-local-copy-of-this-repo) above.
83
-
84
-
No installation is needed. When the HTML page is opened in the browser, the _Docsify_ library will be fetched from a CDN by the browser.
85
-
86
-
### 2. Run
87
-
88
-
#### 2.1 Serve
89
-
90
-
Start running a local server to preview your site.
91
-
92
-
Here are some options below, otherwise there is a much longer list [here](https://gist.github.com/willurd/5720255).
93
-
94
-
- Serve from docs directory.
68
+
- Run Python web server.
95
69
```bash
96
70
$ cd docs
97
71
$ python3 -m http.server 3000
98
72
$ python2 -m SimpleHTTPServer 3000
99
73
```
100
-
- Serve from project root.
74
+
- Run [Docsify CLI](#docsify-cli) web server. This must be installed locally.
101
75
```bash
102
-
$ #Requires Docsify CLI.
76
+
$ #From project root.
103
77
$ docsify serve docs
104
-
$ # Shorter form, from root of this project:
78
+
$ # Shortcut.
105
79
$ make docs
106
80
```
81
+
- Run using something else. Choose from this list - [link](https://gist.github.com/willurd/5720255).
82
+
83
+
**Aliases**
84
+
85
+
Pro-tip! You can also add aliases to either your `~/.bashrc` or `~/.aliases` files to make them quick to use across projects.
86
+
87
+
- Setup
88
+
```bash
89
+
$ alias pserve='python3 -m http.server 3000'
90
+
```
91
+
- Run
92
+
```bash
93
+
$ pserve
94
+
```
95
+
96
+
## Quickstart local server
107
97
108
-
You can also add aliases to either your `~/.bashrc` or `~/.aliases` files to make them quick to use across projects.
98
+
Follow these steps to setup and run an existing _Docsify_ project locally . In this case, we get a local copy of this _Docsify Template_ project and serve it.
@@ -156,7 +175,6 @@ Edit your homepage (_docs/README.md_). Complete the `TODO` items, using the sugg
156
175
157
176
### 4. Configure menu structure
158
177
159
-
160
178
#### Auto sidebar
161
179
162
180
You may choose to display the sidebar, but have it populated automatically from headings on a single HTML file - the homepage (_docs/README.md_). This is the way that this project's own docs site is setup.
@@ -301,7 +319,7 @@ See also the [Google Analytics tracking](https://docsify.js.org/#/plugins?id=goo
301
319
302
320
#### Favicon
303
321
304
-
You can customize _index.html_ with a custom faviconifone exists.
322
+
Optionally customize _index.html_ to point to a custom _favicon_,ifyou added one.
305
323
306
324
```html
307
325
<link rel="icon" href="_media/favicon.ico">
@@ -370,7 +388,7 @@ $ docsify serve docs
370
388
371
389
For Server-Side Rendering. I haven't tried this yet.
372
390
373
-
## Static site generator vs Single-Page Applicator
391
+
## Static site vs SPA
374
392
375
393
### Server side rendering
376
394
@@ -380,7 +398,7 @@ However, _Docsify_ provides the option of pre-rendering all the views as static
380
398
381
399
See [Server-Side Rendering](https://docsify.js.org/#/ssr) section of the _Docsify_ docs.
382
400
383
-
### Why not use static site generator?
401
+
### Why not use a static site generator?
384
402
385
403
_Docsify_ is a SPA, not a static-site generator.
386
404
@@ -390,7 +408,7 @@ These are just tools to build a site. What is appropriate depends on your usecas
390
408
391
409
I find _Docsify_ light to add to a project and to use for new projects. So it is a great fit for me.
392
410
393
-
### A static site generator can be heavy
411
+
A static site generator can be heavy to setup and manage.
394
412
395
413
There are dependencies to manage - they might have to be upgraded if their are security vulnerabilities or they are no longer available. Such as plugins and themes for _Jekyll_. And plugins for _Hugo_. Plus you probably need a couple of _JavaScript_ or _CSS_ files that either you or a theme added. Such as _Query_. This _Docsify_ project only needs exactly one _JavaScript_ and one _CSS_ file.
0 commit comments