Inspired by this article.
- Store all the markdown files you intend to convert in the
markdown
folder in the main directory. - Run the index.js script. Or, using the script in
package.json
, runnpm run exec
. - Find generated HTML files, and any included CSS and JS files in the
_site
folder.
It'll take all the markdown files in /markdown
, render them into a basic HTML template, then output the generated files into the /_site
folder.
All the markdown parsing is done by Marked.
The markdown files also have support for a Front Matter-inspired metadata block. The details of the metadata block are listed below.
You can define a page's title in the metadata. Just use the key title
followed by whatever you wish to title the page.
---
title: {Page Title}
---
Add all your CSS stylesheets to the /css
folder in the main directory. To link a stylesheet to a page, you use the metadata block. Use the key stylesheet
followed by the names of the stylesheets you wish to link to that page. If linking multiple stylesheets, separate the names with a comma.
Make sure to ommit the .css
at the end of the stylesheets names.
---
title: {Page Title}
stylesheet: {Stylesheet1}, {Stylesheet2}
---
Similarly to adding CSS stylesheets to a markdown file, to add JS scripts, you put all your scripts into the /scripts
folder in the main directory. To link a script to a page, use the key scripts
followed by the names of the scripts you wish to link to that page. If linking multiple scripts, separate the names with a comma.
Make sure to ommit the .js
at the end of the scripts names.
---
title: {Page Title}
stylesheet: {Stylesheet1}, {Stylesheet2}
scripts: {Script1}, {Script2}
---