markserv 1.17.3 → 1.19.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -10
- package/lib/cli-defs.js +23 -8
- package/lib/cli-help.txt +6 -3
- package/lib/cli.js +1 -15
- package/lib/readme.js +2 -1
- package/lib/server.js +310 -83
- package/lib/templates/directory.html +158 -2
- package/lib/templates/error.html +159 -3
- package/lib/templates/github-markdown-dark.css +1124 -0
- package/lib/templates/github-markdown-light.css +1124 -0
- package/lib/templates/github-markdown-synthwave.css +987 -0
- package/lib/templates/highlight-js-github-gist.css +243 -1
- package/lib/templates/markdown.html +157 -1
- package/lib/templates/markserv.css +191 -519
- package/package.json +32 -30
- package/CHANGELOG.md +0 -145
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<img alt="Markserv Logo" src="https://markserv.github.io/markserv/media/markserv-readme-banner.svg">
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
|
-
> :checkered_flag: serve markdown as html (GitHub style), index directories, and
|
|
5
|
+
> :checkered_flag: serve markdown as html (GitHub style), index directories, and hot-reload as you edit
|
|
6
6
|
|
|
7
7
|
[](https://gitter.im/markserv)
|
|
8
8
|
[](CHANGELOG.md)
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
- Markdown content rendered as HTML
|
|
21
21
|
- GitHub flavor CSS and Syntax Highlighting
|
|
22
22
|
- [Just in Time Templating](#stopwatch-just-in-time-templating): Markdown, HTML & LESS
|
|
23
|
-
-
|
|
23
|
+
- Hot-reload as you edit (no browser plugin required)
|
|
24
24
|
- Directory indexes
|
|
25
25
|
- MIME Type file support
|
|
26
26
|
|
|
@@ -75,20 +75,37 @@ Start Markserv and open the closest README.md file in the browser:
|
|
|
75
75
|
$ readme
|
|
76
76
|
```
|
|
77
77
|
|
|
78
|
-
## :zap:
|
|
78
|
+
## :zap: Hot Reload
|
|
79
79
|
|
|
80
|
-
|
|
80
|
+
Markserv includes built-in hot-reload via WebSocket. When you save a Markdown file, the page content updates instantly without a full page reload and without any browser plugin.
|
|
81
81
|
|
|
82
|
-
-
|
|
83
|
-
- [Firefox](https://addons.mozilla.org/addon/livereload-web-extension/)
|
|
84
|
-
- [Internet Explorer](https://github.com/dvdotsenko/livereload_ie_extension)
|
|
82
|
+
To disable hot-reload, use `--no-hotreload`:
|
|
85
83
|
|
|
86
|
-
|
|
84
|
+
```shell
|
|
85
|
+
markserv --no-hotreload README.md
|
|
86
|
+
```
|
|
87
87
|
|
|
88
88
|
<p align="center">
|
|
89
89
|
<img alt="Markserv Live Reload" src="media/markserv-live-reload.gif" width="100%">
|
|
90
90
|
</p>
|
|
91
91
|
|
|
92
|
+
## :art: Themes
|
|
93
|
+
|
|
94
|
+
Markserv ships with four themes: **dark** (default), **light**, **synthwave**, and **solarized**. You can set the theme from the CLI:
|
|
95
|
+
|
|
96
|
+
```shell
|
|
97
|
+
# Use light theme
|
|
98
|
+
markserv --light README.md
|
|
99
|
+
|
|
100
|
+
# Use synthwave theme
|
|
101
|
+
markserv --synthwave README.md
|
|
102
|
+
|
|
103
|
+
# Or use the --theme flag for any theme
|
|
104
|
+
markserv --theme solarized README.md
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
You can also toggle between themes in the browser using the theme button in the bottom-right corner. Your choice is saved in `localStorage` and persists across hot-reloads.
|
|
108
|
+
|
|
92
109
|
## :link: Markdown Links
|
|
93
110
|
|
|
94
111
|
You can link to an external Markdown file in the same way that you use GitHub Wiki links. You can use the example code here to see how external links work.
|
|
@@ -105,7 +122,13 @@ Example link:
|
|
|
105
122
|
|
|
106
123
|
## :stopwatch: Just in Time Templating
|
|
107
124
|
|
|
108
|
-
Markserv allows you to include nested content
|
|
125
|
+
Markserv allows you to include nested content using `--templates`. Templates are fetched and rendered when you request them in your browser. The `maxDepth` of includes is set to `10`.
|
|
126
|
+
|
|
127
|
+
**Note:** Templating is disabled by default. Enable it with `--templates`:
|
|
128
|
+
|
|
129
|
+
```shell
|
|
130
|
+
markserv --templates README.md
|
|
131
|
+
```
|
|
109
132
|
|
|
110
133
|
If you would like to look at an example, you can look in the [tests/templates](tests/templates/) directory of this repo.
|
|
111
134
|
|
|
@@ -114,7 +137,7 @@ To see the server output of this templating example:
|
|
|
114
137
|
```shell
|
|
115
138
|
$ git clone@github.com/f1lt3r/markserv.git
|
|
116
139
|
$ cd markserv
|
|
117
|
-
$ markserv tests/templates/index.html
|
|
140
|
+
$ markserv --templates tests/templates/index.html
|
|
118
141
|
```
|
|
119
142
|
|
|
120
143
|
### Include Markdown
|
package/lib/cli-defs.js
CHANGED
|
@@ -1,33 +1,48 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
flags: {
|
|
3
3
|
port: {
|
|
4
|
-
type: 'number',
|
|
5
4
|
alias: 'p',
|
|
6
5
|
default: '8642'
|
|
7
6
|
},
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
default:
|
|
8
|
+
hotreload: {
|
|
9
|
+
alias: 'l',
|
|
10
|
+
type: 'boolean',
|
|
11
|
+
default: true
|
|
13
12
|
},
|
|
14
13
|
|
|
15
14
|
address: {
|
|
16
|
-
type: 'string',
|
|
17
15
|
alias: 'a',
|
|
18
16
|
default: 'localhost'
|
|
19
17
|
},
|
|
20
18
|
|
|
21
19
|
silent: {
|
|
22
|
-
type: 'boolean',
|
|
23
20
|
alias: 's',
|
|
24
21
|
default: false
|
|
25
22
|
},
|
|
26
23
|
|
|
27
24
|
verbose: {
|
|
28
|
-
type: 'boolean',
|
|
29
25
|
alias: 'v',
|
|
30
26
|
default: false
|
|
27
|
+
},
|
|
28
|
+
|
|
29
|
+
theme: {
|
|
30
|
+
default: 'dark'
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
light: {
|
|
34
|
+
type: 'boolean',
|
|
35
|
+
default: false
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
synthwave: {
|
|
39
|
+
type: 'boolean',
|
|
40
|
+
default: false
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
templates: {
|
|
44
|
+
type: 'boolean',
|
|
45
|
+
default: false
|
|
31
46
|
}
|
|
32
47
|
}
|
|
33
48
|
}
|
package/lib/cli-help.txt
CHANGED
|
@@ -3,9 +3,12 @@ $ markserv <file/dir>
|
|
|
3
3
|
$ readme (serve closest README.md file)
|
|
4
4
|
|
|
5
5
|
Options
|
|
6
|
-
--port, -p, HTTP port [port] (
|
|
7
|
-
--
|
|
6
|
+
--port, -p, HTTP port [port] (8642)
|
|
7
|
+
--hotreload, -l Hot-reload via WebSocket (true), disable with --no-hotreload
|
|
8
8
|
--browser, -b Launch browser (true)
|
|
9
9
|
--silent, -i Silent (false)
|
|
10
10
|
--address, -a Serve on ip/address [address] (localhost)
|
|
11
|
-
--verbose, -v Verbose output (false)
|
|
11
|
+
--verbose, -v Verbose output (false)
|
|
12
|
+
--light Use light theme (default: dark)
|
|
13
|
+
--synthwave Use synthwave/retro-neon theme (default: dark)
|
|
14
|
+
--templates Enable {file:}, {markdown:}, {html:}, {less:} templating (false)
|
package/lib/cli.js
CHANGED
|
@@ -14,21 +14,7 @@ const cliDefs = require('./cli-defs')
|
|
|
14
14
|
const cliOpts = meow(cliHelp, cliDefs)
|
|
15
15
|
|
|
16
16
|
const validateServerPath = (serverPath, cwd) => {
|
|
17
|
-
|
|
18
|
-
return cwd
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
let validatedPath
|
|
22
|
-
|
|
23
|
-
if (serverPath[0]) {
|
|
24
|
-
validatedPath = path.normalize(path.join(cwd, serverPath))
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
if (serverPath[0] === '/' || serverPath[0] === '.') {
|
|
28
|
-
validatedPath = path.normalize(path.join(cwd, serverPath))
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return validatedPath
|
|
17
|
+
return path.resolve(cwd, serverPath)
|
|
32
18
|
}
|
|
33
19
|
|
|
34
20
|
const run = opts => {
|