-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
158 lines (150 loc) · 4.12 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
// eslint-why docs
const lib = require('./lib')
/**
* # httpmd - `http-server-md`.
*
* Description TODO.
*
* > Configurable static file server with markdown-it for parsing Markdown.
*
* @module http-server-md
* @license MIT
* @example <caption>httpmd help</caption>
* httpmd [path] [options]
*
* Serve local files
*
* Commands:
* httpmd print-config Log the merged configuration to the console
* httpmd gen-config Generate a new configuration file
* httpmd render Render local files to static HTML
* httpmd serve [path] [options] Serve local files [default]
*
* Options:
* --log-level, -l Log level, increase to debug
* [string] [choices: 'error', 'info', 'warn', 'debug'] [default: 'error']
* --path, -p Root directory
* [string] [required] [default: '/home/user/code/personal/http-server-md']
* --help Show help [boolean]
* --version Show version number [boolean]
* --port Port number to spawn HTTP server on
* [number] [required] [default: 8960]
*
* Examples:
* httpmd gen-config > .httpmdrc.json Generate basic configuration
*
* @example <caption>httpmd</caption>
* [cli] › ★ star read config from /.httpmdrc.json
* [cli] › ★ star using template default
* [cli] › ★ star using md plugin markdown-it-smartarrows
* [cli] › ★ star using md plugin markdown-it-anchor
* [cli] › ★ star using md plugin markdown-it-highlightjs
* [cli] › ★ star serving content from /home/user/code/personal/http-server-md
* [cli] › ★ star listening at http://localhost:8960
*
* @example <caption>httpmd gen-config > .httpmdrc.json</caption>
* {
* minify: true,
* excludeGitIgnore: true,
* template: {
* name: 'serve-markdown-it-template-default',
* config: {
* maxWidth: '960px',
* sections: {
* contentHeader: true,
* settings: true,
* debug: true,
* content: true,
* order: [
* 'settings',
* 'content',
* 'debug'
* ]
* },
* explorer: {
* icons: true,
* columns: [
* 'name',
* 'user',
* 'group',
* 'mode',
* 'type',
* 'size'
* ],
* dataTable: {
* searchable: true,
* sortable: true,
* perPage: 25,
* perPageSelect: [
* 10,
* 25,
* 50,
* 100
* ],
* fixedHeight: false,
* layout: {
* top: '{select}{search}',
* bottom: '{pager}'
* }
* }
* },
* headerBar: false,
* settingsBar: false,
* dataTable: false
* }
* },
* md: {
* typographer: true,
* linkify: true,
* html: true,
* plugins: [
* {
* name: 'markdown-it-smartarrows',
* init: 'after',
* config: {
* auto: true,
* code: true
* }
* },
* {
* name: 'markdown-it-anchor',
* config: {
* permalink: true,
* permalinkBefore: true,
* permalinkSymbol: '§'
* },
* init: 'after'
* },
* {
* name: 'markdown-it-highlightjs',
* config: {
* auto: true,
* code: true
* },
* init: 'after'
* }
* ]
* }
* }
*/
/**
* @external serve-markdown-it-template-default
* @see https://github.com/f3rno64/serve-markdown-it-template-default
*/
/**
* @external markdown-it
* @see https://github.com/markdown-it/markdown-it
*/
/**
* @external cosmiconfig
* @see https://github.com/davidtheclark/cosmiconfig
*/
/**
* @external markdown-it-highlightjs
* @see https://github.com/valeriangalliat/markdown-it-highlightjs
*/
/**
* @external highlightjs
* @see https://github.com/highlightjs/highlight.js
*/
module.exports = lib