Skip to content

Commit cfdd4e9

Browse files
committed
docs: Update homepage
1 parent 90a5a1b commit cfdd4e9

File tree

1 file changed

+71
-53
lines changed

1 file changed

+71
-53
lines changed

docs/README.md

Lines changed: 71 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -14,50 +14,39 @@ If you know what _Docsify_ is and want to start using it immediately, feel free
1414

1515
_Note: The instructions in this repo are intended for Linux and macOS environments._
1616

17-
18-
## Why use Docsify for a docs site?
17+
## Why use _Docsify_?
1918

2019
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.
2120

2221
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.
2322

2423
![icon](_media/docs_brackets.png)
2524

26-
## Docsify basics
25+
## _Docsify_ basics
2726

2827
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_.
2928

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
3630

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.
3832

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.
4038

41-
```
42-
$ # Clone with SSH
43-
$ git clone git@github.com:MichaelCurrin/docsify-template.git
44-
$ # Clone with HTTPS
45-
$ git clone https://github.com/MichaelCurrin/docsify-template.git
46-
```
47-
48-
```bash
49-
$ cd docsify-template
50-
```
39+
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.
5140

52-
## Doc links
41+
### Linking to pages
5342

5443
Instructions for creating valid Docsify links in your markdown files.
5544

5645
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.
5746

5847
As usual external resource can be linked e.g. `https://example.com`.
5948

60-
## Rules for internal links
49+
**Rules for internal links**
6150

6251
Apply these rules to the latter part of markdown URLs such as `[Text](page.md)`.
6352

@@ -72,46 +61,65 @@ Apply these rules to the latter part of markdown URLs such as `[Text](page.md)`.
7261
- Do not reference the `docs` directory in the path. e.g. `/docs/foo.md`
7362
- Do not refer to content outside of the `docs` directory. e.g. `../README.md`
7463

64+
## Serve a _Docsify_ site locally
7565

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.
7967

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.
9569
```bash
9670
$ cd docs
9771
$ python3 -m http.server 3000
9872
$ python2 -m SimpleHTTPServer 3000
9973
```
100-
- Serve from project root.
74+
- Run [Docsify CLI](#docsify-cli) web server. This must be installed locally.
10175
```bash
102-
$ # Requires Docsify CLI.
76+
$ # From project root.
10377
$ docsify serve docs
104-
$ # Shorter form, from root of this project:
78+
$ # Shortcut.
10579
$ make docs
10680
```
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
10797

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.
99+
100+
### 1. Install
101+
102+
Clone this repo to your machine.
109103

110104
```bash
111-
alias pserve='python3 -m http.server 3000'
112-
alias docs='docsify serve docs'
105+
$ # Clone with SSH
106+
$ git clone git@github.com:MichaelCurrin/docsify-template.git
107+
$ # Clone with HTTPS
108+
$ git clone https://github.com/MichaelCurrin/docsify-template.git
109+
```
110+
111+
```bash
112+
$ cd docsify-template
113113
```
114114

115+
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.
116+
117+
### 2. Run
118+
119+
#### 2.1 Serve
120+
121+
Follow [Serve a Docsify site locally](#serve-a-docsify-site-locally) instructions.
122+
115123
#### 2.2 View
116124

117125
Then open http://localhost:3000 in the browser.
@@ -129,7 +137,18 @@ Follow to steps in this section copy a base structure and configs from this proj
129137

130138
### 1. Get this project locally
131139

132-
Clone this template repo to your machine using the [steps](#get-a-local-copy-of-this-repo) above, so you can use it copy files from later.
140+
Clone this template repo to your machine using the steps below, so you can use it copy files from later.
141+
142+
```bash
143+
$ # Clone with SSH
144+
$ git clone git@github.com:MichaelCurrin/docsify-template.git
145+
$ # Clone with HTTPS
146+
$ git clone https://github.com/MichaelCurrin/docsify-template.git
147+
```
148+
149+
```bash
150+
$ cd docsify-template
151+
```
133152

134153
### 2. Create base structure
135154

@@ -156,7 +175,6 @@ Edit your homepage (_docs/README.md_). Complete the `TODO` items, using the sugg
156175

157176
### 4. Configure menu structure
158177

159-
160178
#### Auto sidebar
161179

162180
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
301319
302320
#### Favicon
303321
304-
You can customize _index.html_ with a custom favicon if one exists.
322+
Optionally customize _index.html_ to point to a custom _favicon_, if you added one.
305323
306324
```html
307325
<link rel="icon" href="_media/favicon.ico">
@@ -370,7 +388,7 @@ $ docsify serve docs
370388
371389
For Server-Side Rendering. I haven't tried this yet.
372390
373-
## Static site generator vs Single-Page Applicator
391+
## Static site vs SPA
374392
375393
### Server side rendering
376394
@@ -380,7 +398,7 @@ However, _Docsify_ provides the option of pre-rendering all the views as static
380398
381399
See [Server-Side Rendering](https://docsify.js.org/#/ssr) section of the _Docsify_ docs.
382400
383-
### Why not use static site generator?
401+
### Why not use a static site generator?
384402
385403
_Docsify_ is a SPA, not a static-site generator.
386404
@@ -390,7 +408,7 @@ These are just tools to build a site. What is appropriate depends on your usecas
390408
391409
I find _Docsify_ light to add to a project and to use for new projects. So it is a great fit for me.
392410
393-
### A static site generator can be heavy
411+
A static site generator can be heavy to setup and manage.
394412
395413
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.
396414

0 commit comments

Comments
 (0)