A github similar static server with a markdown renderer.
npm i github-similar-server -g
github-similar-server -h
npm i github-similar-server --save
const app = require('express')()
const gss = require('github-similar-server')
// Use as middleware
app.use('__', gss())
// Or create an express server
const gssApp = gss({
port: 10000, // required!
basePath: '/' // public path
}).then(app => {
// some code here
})
// gssApp.close(() => { console.log('closed') })
github-similar-server works on which file or folder. (required)
- Type:
string
the service port
- Type:
number
- Default:
8080
the service's base path
- Type:
string
- Default:
'/'
Do not log anything
- Type:
boolean
- Default:
false
Enable markdown render
- Type:
boolean
- Default:
true
Enable static file service
- Type:
boolean
- Default:
true
The path of markdown's template
- Type:
string
- Default:
./src/template.html
The string source of markdown's template, It has more higher priority.
- Type:
string
Extra parameters of template
- Type:
{}
- Type:
string
- Default:
'max-age=-1'
baseDir
is not recommended to be assigned if you don't know what you are doing.
Because it has some troubles in ecstatic. jfhbrook/node-ecstatic#235
- Type:
string
- Default:
req.baseUrl
Rest options extend ecstatic options
-
Support gfm and render github style markdown when visit
/README.md
or/path/to/md.md
. -
The service would response index.html when contains index.html and README.md via url
/
. -
It would response raw markdown text when with query string
?raw=true
.
Use Lodash.template with template data:
- title
- markdownHTML
- filename
- remark-preset-gfm - Remark preset for gfm (GitHub Favorite Markdown)
MIT