Hi all,
I've been doing a lot of work with Markdown recently and it occurred to me that Node-RED would make a nice platform for serving up a Markdown web.
So I've started to put together a new node to do that. No code yet, just getting warmed up and I need to finish off uibuilder v2. However, I thought I would share with the community to see if anyone has any feedback.
The code will be posted to: https://github.com/TotallyInformation/node-red-contrib-static-markdown
You can install it from GitHub the usual way but it doesn't actually do anything yet
Here is the current README - please leave any comments and ideas in this thread if you have any.
Note that, at least to begin with, the node will not accept any inputs or have any outputs.
node-red-contrib-staticMarkdown
Serve up a folder of static markdown files from Node-RED
In the admin panel for the node instance, provide a url path and a source folder.
The source folder can contain sub-folders. Files with an extension of .md
will be served as web pages.
Each folder may contain a file named index.md
and if so, this will be used as the default page for that folder.
Markup
The source files can contain any valid CommonMark markup and may also contain metadata in a YAML header. e.g.
---
title: This is the title for my markdown file
---
# My markdown file
This file will be served as HTML with the help of Node-RED.
Templates
The source files folder may contain a sub-folder named .templates
. If it does, it should contain a Handlebars template called default.hba
.
If the .templates
folder does not exist, a default template will be used.
Dependencies
-
Glob - Recursively read a directory, returning an array with all files that match an specified pattern.
-
marked - Compile Markdown to HTML.
-
front-matter - Extract meta data (front matter) from documents.
-
fs-extra - Adds new functions to Node’s native file-system module (fs) and add promise support for the existing ones.