
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Generate HTML with Mustache and Markdown
Good enough to give it a shot. Feedback, issues and pull requests welcome.
$ npm install -g blogdown
src/template.mustache
with HTML and a {{{md}}}
placeholder somewheresrc/index.md
with Markdown in itblogdown
from the root of the project directory and inspect the generated site/index.html
template.mustache
file in each directory will be used as the mustache template unless an item has a .html
or .mustache
template defined.template.json
file can be created to inherit JSON properties into each item in the same folder and sub folderstemplate
folder can be created and filled with mustache templates that will be used as partials. Reference the partials with {{>partial-name}}
.template.json
using the file name as the key.Global configs are stored in a blogdown.json
file in the root of your project.
The file defines date formats and lists of files, as well as any custom properties you want to define that will be made available to all mustache templates under the "blogdown." object namespace.
A custom output folder can also be specificed here using the siteDir
property.
Blogdown uses moment.js for date formatting. A list of date formats can be configured in the config file:
"dates" : {
"long" : "ddd, DD. MMMM YYYY - HH:mm:ss",
"short" : "DD.MM.YYYY HH:mm:ss",
// ...
}
The mustache templates can refer to the dates like this:
{{dates.long.created}}
for the long format showing the file creation date and time{{dates.long.modified}}
for the long format showing the file's last modified date and time{{dates.short.created}}
You can specify custom lists of files in the global config files:
"lists" : {
"articles" : {
"filter" : "file.path = blog/*",
"sort" : "file.created DESC",
"limit" : 25
}
}
An array of items with the configured name will be available in the mustache template:
{{#articles}}
<a href="{{{file.path}}}"><h3>{{heading}}</h3></a>
<p>{{tldr}}</p>
{{/articles}}
This will show 25 items from the blog folder ordered newest files first.
By default, items are generated with their file names. If you want to use a different file name, you need to put "file" : { "name" : "different" }
in the corresponding .json
file.
The model of each item that is passed to Mustache for rendering looks like this:
{
// File related meta information:
file : {
path : 'path/to/file.html',
name : 'file', // without the extension
root : '../..', // relative path to root dir
created : '2013-03-17T22:01:53+01:00',
modified : '2013-03-17T22:01:53+01:00',
active : true // if this file is currently rendered, otherwise false
},
// True if blogdown was called with --publish, otherwise false
publish : true,
// Markdown:
md : '<p>parsed from markdown</p>',
// Formatted dates according to config in "blogdown.json":
dates : {
article : {
created : 'Sun, 31. March 2013 - 17:24 CET',
modified : 'Sun, 31. March 2013 - 17:24 CET'
}
},
// Lists of items according to config in "blogdown.json":
newArticles : [{ ... }, { ... }],
coolProjects : [{ ... }, { ... }],
// And any other properties in "blogdown.json" are available
blogdown.anyProperty : 'defined in blogdown.json'
anyProperty : 'defined in a .json file'
}
To get more information about which templates and items where found and which
properties they contained, use --debug
(or -d
).
$ blogdown --debug
$ blogdown -d
This project was build on top of the hard work of other people:
1.1.0
6731ebf
allow lines before json header (#13) (Maksim Lin)
- dont make json header start on first line of file
this allows json header to start on lines other than first line of a file, and so allow bracketing it with jekyll style front-matter '---' lines
update to latest package versions
better handling of frontmatter, add test
fc15fe7
Make list sort test pass on different node versions3a5a6a9
Update Studio Changes to v2Released by Maximilian Antoni on 2020-01-17.
FAQs
Generate HTML with Mustache and Markdown
The npm package blogdown receives a total of 2 weekly downloads. As such, blogdown popularity was classified as not popular.
We found that blogdown demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.