markserv 1.17.4 → 1.20.0
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 +60 -29
- package/lib/cli-defs.js +23 -3
- package/lib/cli-help.txt +6 -3
- package/lib/cli.js +1 -15
- package/lib/server.js +290 -49
- 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 +240 -1
- package/lib/templates/markserv.css +191 -519
- package/package.json +8 -4
- package/CHANGELOG.md +0 -155
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
|
|
@@ -233,28 +256,36 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
|
|
|
233
256
|
<!-- prettier-ignore-start -->
|
|
234
257
|
<!-- markdownlint-disable -->
|
|
235
258
|
<table>
|
|
236
|
-
<
|
|
237
|
-
<
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
<
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
259
|
+
<tbody>
|
|
260
|
+
<tr>
|
|
261
|
+
<td align="center" valign="top" width="14.28%"><a href="https://f1lt3r.io"><img src="https://avatars1.githubusercontent.com/u/1218446?v=4?s=100" width="100px;" alt="Alistair MacDonald"/><br /><sub><b>Alistair MacDonald</b></sub></a><br /><a href="https://github.com/f1lt3r/markserv/commits?author=F1LT3R" title="Code">💻</a></td>
|
|
262
|
+
<td align="center" valign="top" width="14.28%"><a href="https://finenet.com.tw"><img src="https://avatars3.githubusercontent.com/u/154892?v=4?s=100" width="100px;" alt="陳瀛洲"/><br /><sub><b>陳瀛洲</b></sub></a><br /><a href="https://github.com/f1lt3r/markserv/commits?author=ChenYingChou" title="Code">💻</a></td>
|
|
263
|
+
<td align="center" valign="top" width="14.28%"><a href="https://kflu.github.io/"><img src="https://avatars2.githubusercontent.com/u/1031978?v=4?s=100" width="100px;" alt="Kefei Lu"/><br /><sub><b>Kefei Lu</b></sub></a><br /><a href="https://github.com/f1lt3r/markserv/commits?author=kflu" title="Code">💻</a></td>
|
|
264
|
+
<td align="center" valign="top" width="14.28%"><a href="https://www.imyzf.com"><img src="https://avatars1.githubusercontent.com/u/8298849?v=4?s=100" width="100px;" alt="Zhenfei You"/><br /><sub><b>Zhenfei You</b></sub></a><br /><a href="https://github.com/f1lt3r/markserv/commits?author=imyzf" title="Code">💻</a></td>
|
|
265
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/anslzo"><img src="https://avatars2.githubusercontent.com/u/11443948?v=4?s=100" width="100px;" alt="Andrew"/><br /><sub><b>Andrew</b></sub></a><br /><a href="https://github.com/f1lt3r/markserv/commits?author=anslzo" title="Code">💻</a></td>
|
|
266
|
+
<td align="center" valign="top" width="14.28%"><a href="https://daniel.perez.sh"><img src="https://avatars2.githubusercontent.com/u/1436271?v=4?s=100" width="100px;" alt="Daniel Perez"/><br /><sub><b>Daniel Perez</b></sub></a><br /><a href="https://github.com/f1lt3r/markserv/commits?author=danhper" title="Code">💻</a></td>
|
|
267
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/sushruth"><img src="https://avatars0.githubusercontent.com/u/2114206?v=4?s=100" width="100px;" alt="Sushruth Shastry"/><br /><sub><b>Sushruth Shastry</b></sub></a><br /><a href="https://github.com/f1lt3r/markserv/commits?author=sushruth" title="Code">💻</a></td>
|
|
268
|
+
</tr>
|
|
269
|
+
<tr>
|
|
270
|
+
<td align="center" valign="top" width="14.28%"><a href="https://ptkdev.it"><img src="https://avatars1.githubusercontent.com/u/442844?v=4?s=100" width="100px;" alt="Patryk Rzucidło"/><br /><sub><b>Patryk Rzucidło</b></sub></a><br /><a href="https://github.com/f1lt3r/markserv/commits?author=ptkdev" title="Code">💻</a></td>
|
|
271
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/EstebanMarin"><img src="https://avatars3.githubusercontent.com/u/13613037?v=4?s=100" width="100px;" alt="EstebanMarin"/><br /><sub><b>EstebanMarin</b></sub></a><br /><a href="https://github.com/f1lt3r/markserv/commits?author=EstebanMarin" title="Code">💻</a></td>
|
|
272
|
+
<td align="center" valign="top" width="14.28%"><a href="https://matthewreishus.com/"><img src="https://avatars3.githubusercontent.com/u/937354?v=4?s=100" width="100px;" alt="Matthew Reishus"/><br /><sub><b>Matthew Reishus</b></sub></a><br /><a href="https://github.com/f1lt3r/markserv/commits?author=mreishus" title="Documentation">📖</a></td>
|
|
273
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/danielwe"><img src="https://avatars3.githubusercontent.com/u/5809017?v=4?s=100" width="100px;" alt="Daniel Wennberg"/><br /><sub><b>Daniel Wennberg</b></sub></a><br /><a href="https://github.com/f1lt3r/markserv/commits?author=danielwe" title="Code">💻</a></td>
|
|
274
|
+
<td align="center" valign="top" width="14.28%"><a href="http://thepete.net"><img src="https://avatars1.githubusercontent.com/u/65444?v=4?s=100" width="100px;" alt="Pete Hodgson"/><br /><sub><b>Pete Hodgson</b></sub></a><br /><a href="https://github.com/f1lt3r/markserv/commits?author=moredip" title="Code">💻</a></td>
|
|
275
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/ghost"><img src="https://avatars3.githubusercontent.com/u/10137?v=4?s=100" width="100px;" alt="Deleted user"/><br /><sub><b>Deleted user</b></sub></a><br /><a href="https://github.com/f1lt3r/markserv/commits?author=ghost" title="Documentation">📖</a></td>
|
|
276
|
+
<td align="center" valign="top" width="14.28%"><a href="https://www.ldaws.com"><img src="https://avatars2.githubusercontent.com/u/760143?v=4?s=100" width="100px;" alt="Liam Dawson"/><br /><sub><b>Liam Dawson</b></sub></a><br /><a href="https://github.com/f1lt3r/markserv/commits?author=liamdawson" title="Code">💻</a></td>
|
|
277
|
+
</tr>
|
|
278
|
+
<tr>
|
|
279
|
+
<td align="center" valign="top" width="14.28%"><a href="https://choly.ca/"><img src="https://avatars.githubusercontent.com/u/943597?v=4?s=100" width="100px;" alt="Ilia Choly"/><br /><sub><b>Ilia Choly</b></sub></a><br /><a href="https://github.com/f1lt3r/markserv/commits?author=icholy" title="Code">💻</a></td>
|
|
280
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/rcarrionr"><img src="https://avatars.githubusercontent.com/u/26934511?v=4?s=100" width="100px;" alt="Richard Carrion"/><br /><sub><b>Richard Carrion</b></sub></a><br /><a href="https://github.com/f1lt3r/markserv/commits?author=rcarrionr" title="Code">💻</a></td>
|
|
281
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/alysonfs"><img src="https://avatars.githubusercontent.com/u/928412?v=4?s=100" width="100px;" alt="Alyson Felipe"/><br /><sub><b>Alyson Felipe</b></sub></a><br /><a href="https://github.com/f1lt3r/markserv/issues?q=author%3Aalysonfs" title="Bug reports">🐛</a></td>
|
|
282
|
+
</tr>
|
|
283
|
+
</tbody>
|
|
254
284
|
</table>
|
|
255
285
|
|
|
256
|
-
<!-- markdownlint-
|
|
286
|
+
<!-- markdownlint-restore -->
|
|
257
287
|
<!-- prettier-ignore-end -->
|
|
288
|
+
|
|
258
289
|
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
|
259
290
|
|
|
260
291
|
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
|
package/lib/cli-defs.js
CHANGED
|
@@ -5,9 +5,10 @@ module.exports = {
|
|
|
5
5
|
default: '8642'
|
|
6
6
|
},
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
alias: '
|
|
10
|
-
|
|
8
|
+
hotreload: {
|
|
9
|
+
alias: 'l',
|
|
10
|
+
type: 'boolean',
|
|
11
|
+
default: true
|
|
11
12
|
},
|
|
12
13
|
|
|
13
14
|
address: {
|
|
@@ -23,6 +24,25 @@ module.exports = {
|
|
|
23
24
|
verbose: {
|
|
24
25
|
alias: 'v',
|
|
25
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
|
|
26
46
|
}
|
|
27
47
|
}
|
|
28
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 => {
|