Skip to content

Commit 83e8592

Browse files
committed
docs: Update docs/README.md
1 parent b083fa0 commit 83e8592

File tree

1 file changed

+90
-24
lines changed

1 file changed

+90
-24
lines changed

docs/README.md

Lines changed: 90 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
# Docsify Template
2-
> Live demo of a light docs site built on _Docsify-JS_ and running on Github Pages
2+
> Skeleton of a light docs site built on _Docsify-JS_ and running on Github Pages
33
44
Demo site: [link](https://michaelcurrin.github.io/docsify-template/#/).
55

66
Convert your docs folder into a pretty docs website using [Docsify-JS](https://docsify.js.org/) and some minimal setup. This project can be used as a template or reference for your own.
77

88
My own aim is to turn the docs of many of my existing projects into doc sites with minimal effort to convert them and maintain them.
99

10-
## Basics to get a site working
10+
_Note: The instructions in this repo for for Linux and Mac environments._
11+
12+
## How to serve a docs site with Docsify
1113

1214
1. Add a few files to your existing docs folder. You can use this project's files to get you going.
1315
- **index page** - Homepage of the your docs site. This will setup the app using the _Docsify_ library, set a theme and apply other configurations.
@@ -17,38 +19,93 @@ My own aim is to turn the docs of many of my existing projects into doc sites wi
1719

1820
Note that this works _without_ editing 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_.
1921

20-
## Setup a site
2122

22-
Since the idea is to add to an existing project, is it not that useful to create your own project from this repo. But you should copy the sample files from this project in your own project's docs directory.
23+
## Quickstart
24+
25+
### Setup
26+
27+
No installation needed. Just a connection to the internet in order to load the _Docsify_ library in the browser.
28+
29+
### Run locally
30+
31+
```bash
32+
$ # Clone with SSH
33+
$ git clone git@github.com:MichaelCurrin/docsify-template.git
34+
$ # Clone with HTTPS
35+
$ git clone https://github.com/MichaelCurrin/docsify-template.git
36+
$ cd docsify-template
37+
$ ./serve.sh
38+
```
39+
40+
Then open http://localhost:3000 in the browser.
41+
42+
User notes:
43+
44+
- When viewing the site, if you scroll down far enough you will see a hamburger menu which lets you dynamically open or close the sidebar.
2345

24-
### Copy files
46+
## Setup your own docs site
2547

26-
TBC
48+
The idea is to add to an existing project / git repo, so it is not that useful to create your own project from this repo. So rather copy base structure and configs from this project to your own, then customize them for your needs.
49+
50+
```bash
51+
$ cd <PATH_TO_THIS_REPO>
52+
$ cd docs
53+
```
54+
55+
### Create base structure
56+
57+
```bash
58+
$ cp index.html README.md <PATH_TO_YOUR_REPO>/docs
59+
$ cd <PATH_TO_YOUR_REPO>/docs
60+
$ touch .nojekyll _coverpage.md _sidebar_.md
61+
```
2762

2863
### Configure index page
2964

30-
TBC
65+
You can leave the _index.html_ page as it is.
66+
67+
Optionally you can set coverpage and sidebar options to `false`, or delete those rows.
3168

3269
### Configure sidebar
3370

34-
Note file paths are relative to docs directory.
71+
The sidebar is the menu page on the left of the docs and shows on all page.
72+
73+
Use this project's [sidebar](https://raw.githubusercontent.com/MichaelCurrin/docsify-template/master/docs/_sidebar.md) raw file on Github as a reference to edit your own *_sidebar.md* file.
74+
75+
The format should be markdown bullet points which can be nested. Include links to you files - note that paths are relative to docs directory.
3576

3677
With sidebar enabled and not sidebar details set, your index page will use its own page outline as the menu but with no access to subpages. You might even want your entire site to be a single page based on _README.md_, with section headings added to your menu automatically (no need to maintain sidebar).
3778

38-
The top of the side bar will point to the site's root - this will take you to the top of the cover page, rather than the _README.md_. You can create a first item in the sidebar which points to the _README.md_ top element, but that will sort of duplicate having the sidebar heading leading to small confusion for a user. So far attempted with `[Home](README.md#docsify-template)` which gives a funny URL and `[Home](#docsify-template)` which does not load from other pages.
79+
The top of the side bar will point to the site's root - this will take you to the top of the cover page, rather than the _README.md_. You can create a first item in the sidebar which points to the _README.md_ top element, but that will sort of duplicate having the sidebar heading leading to small confusion for a user.
80+
81+
These approaches were attempted but do not work:
3982

40-
When viewing the site, if you scroll down far enough you will see a hamburger menu which lets you dynamically open or close the sidebar.
83+
```
84+
# This README in the URL when you click on it.
85+
[Home](README.md#docsify-template)
86+
87+
# This is not a valid ID when clicking from a file other than the _docs/README.md_ file.
88+
[Home](#docsify-template)
89+
```
4190

4291
### Configure cover page
4392

44-
TBC
93+
Use this project's [coverpage](https://raw.githubusercontent.com/MichaelCurrin/docsify-template/master/docs/_coverpage.md) raw file on Github as a reference to edit your own *_coverpage.md* file.
94+
95+
You could include a logo image above your project title. For example, you could do this if you have a existent media file.
96+
97+
```
98+
![icon](_media/logo.svg)
99+
```
45100

46101
### Style
47102

48-
Edit _index.html_.
103+
How to customize the style of your project.
49104

50105
#### Color
51106

107+
Edit _index.html_.
108+
52109
Set a theme color. Defaults to theme's default if not set - green for Vue and blue for Buble.
53110

54111
This variable affects how some content looks, such as quoted blocks, underlined text and buttons.
@@ -63,36 +120,45 @@ More on Docsify [theme color](https://docsify.js.org/#/configuration?id=themecol
63120

64121
#### Themes
65122

66-
Choose a style you like.
123+
Edit _index.html_.
124+
125+
Find the style which is set in the `<head>` tag, which looks like this.
126+
127+
```html
128+
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/<THEME>">
129+
```
67130

68-
Options:
131+
Replace the end of URL with one of these four themes.
69132

70133
- `vue.css`
71134
- `buble.css`
72135
- `dark.css`
73136
- `pure.css`
74137

75-
`<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/<THEME>.css">`
76138

77-
Remove `lib/` from the theme URL to get the uncompressed CSS file.
139+
You can optionally remove `/lib` from the theme URL to get the _uncompressed_ CSS file.
78140

79141
More on Docsify [themes](https://docsify.js.org/#/themes?id=themes) guide.
80142

81143

82-
### Docsify CLI
144+
## Docsify CLI
83145

84-
View the Docsify [Quickstart](https://docsify.js.org/#/quickstart) guide for instructions on setting up the CLI tool and running a site.
146+
The CLI tool is optional. View the Docsify [Quickstart](https://docsify.js.org/#/quickstart) guide to set up the CLI tool and see how to do the following:
85147

86-
The CLI tool is optional and is useful for the following:
87-
88-
- Setup an initial _README.md_ (duplicated from project root), _index.html_ and _.nojekyll_ in your a target directory such as _docs_. You can do this by hand or using a template if you don't want the CLI to do it for you.
89-
- Serve the docs site locally, with hot reload.
148+
- `init`: Setup an initial _README.md_ (duplicated from project root), _index.html_ and _.nojekyll_ in your a target directory such as _docs_. You can do this by hand or using a template if you don't want the CLI to do it for you.
149+
- `serve`: Serve the docs site locally, with hot reload.
90150

91151

92152
## Why not a static site generator?
93153

94154
Jekyll and Hugo are options for static site generators which can use themes suited to documentation and they can build off of a docs directory. If you want to read more about those, see my [resources](https://github.com/MichaelCurrin/static-sites-generator-resources) project.
95155

96-
A static site generator can be heavy - managing dependencies, building HTML, theming. You might have to add front matter to your doc files. You have to set your menu structure in a similar way to _Docsify_.
156+
A static site generator can be heavy. There are dependencies (Ruby gems) to manage, HTML to build and a theme to setup (you may lose or gain functionality when switching between Jekyll themes because they use their own templates and layouts). You probably have to add _frontmatter_ to your doc files so they can inherit from layouts and have the correct metadata like title.
157+
158+
As with _Docsify_, you will probably have to create a config file which covers the structure of your project for use in the sidebar.
159+
160+
Unlike building static files with HTML, with with Docsify there is a single page application running off of a _index.html_ - on each request, a markdown file is fetched by the client and rendered as HTML with a theme and menu. The performance will depend more on the server when serving static HTML pages (prebuild and serve page on the client) or on the client when using a single page application (build structure on the client).
161+
162+
Also, the _Docsify_ approach will only work if JavaScript is enabled.
97163

98-
Also, with a static site generator you would build HTML files to serve, while with Docsify there is a single page application running off of a _index.html_ - on each request, a markdown file is fetched by the client and rendered as HTML with a theme and menu.
164+
The _Docsify_ site says it supports back to Internet Explorer 11, so that at least helps for a wider audience of users.

0 commit comments

Comments
 (0)