
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
Stachedown renders Mustache templates written in Markdown.
npm install stachedown
Stachedown can be used to render HTML from Markdown-Mustache templates and inject Mustache directly into Markdown without rendering the Makrdown.
var Stachedown = require("stachedown"),
stachedown = Stachedown();
var template = "{{a}} is *{{b}}*.",
data = {a: 'Shrek', b: 'love'};
stachedown.render(template, data);
// => "<p>Shrek is <em>love</em>.</p>\n"
var Stachedown = require("stachedown"),
stachedown = Stachedown();
var template = "{{a}} is *{{b}}*.",
data = {a: 'Shrek', b: 'love'};
stachedown.inject(template, data);
// => "Shrek is *love*."
Stachedown requires mustache.js and marked. While it does not provided anything more than functions, Stachedown does expose its dependencies for their own configuration options.
var Stachedown = require("stachedown"),
Marked = Stachedown.Marked,
Mustache = Stachedown.Mustache;
Marked options can also be passed directly to the Stachedown constructor and will be used for each render with that Stachedown instance. See marked for more details.
var Stachedown = require("stachedown"),
stachedown = Stachedown({marked options});
Stachedown can determine whether marked is configured asynchronously and adapt to compliment an asynchronous call.
stachedown.render(template, data, function(error, html) {
// Note: This only works for #render().
// Stachedown#inject() is always synchronous.
});
Suppose a template is rendered with an object literal as data using Mustache. Mustache ignores missing and undefined variables in templates.
Mustache.render('The {{important_thing}} must be visible.', {});
// => 'The must be visible.'
This output almost always is not ideal. Stachedown exposes two methods #renderStrict() and #injectStrict() to ensure variables exist when put into the template. They have the same function signatures as their #render() and #inject() counterparts.
stachedown.renderStrict('The {{important_thing}} must be visible.', {});
// throws Error
While strict templating is not a direct goal of Stachedown, I thought the use case was good enough to include it within this module as an option.
Contributions are incredibly welcome as long as they are standardly applicable and pass the tests (or break bad ones). Tests are written in Mocha and assertions are done with the Node.js core assert module.
# running tests
npm run test
npm run test-spec # spec reporter
Follow me on Twitter for updates or just for the lolz and please check out my other repositories if I have earned it. I thank you for reading.
FAQs
you got mustache in my markdown
We found that stachedown demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.