README
platformjs-wiki
A simple, minimal, Markdown-based file-based wiki/blog middleware component for express intended for small sites.
Installation
$ npm install platformjs-wiki
Usage
app.use( require("platformjs-wiki")("./wiki") );
The above setup will create an in-memory database of all the files in the directory and add this to the res.locals
array under the "wiki" variable. Thus the entire content of the wiki is accessible to every rendered template on the site. (This obviously is not intended for large wikis, but rather small sites.)
Internals
As stated, the module is, by design, quite simple.
The middleware essentially does this:
- Scan all files in the local directory
- If there is an opening
{{{ }}}
section, evaluate that as JSON - Treat the rest as standard Markdown
- Merge the Markdown as a
content
field into the optional JSON section - Index all the content by date and tags
- Make this data accessible via the
res.locals.wiki
variable