module.exports = { friendlyName: 'To HTML', description: 'Compile a Markdown string into an HTML string.', extendedDescription: 'Expects GitHub-flavored Markdown syntax. Uses [`marked`](https://github.com/chjj/marked)@v0.3.5. '+ 'Inspired by https://github.com/mikermcneil/machinepack-markdown/tree/5d8cee127e8ce45c702ec9bbb2b4f9bc4b7fafac', moreInfoUrl: 'https://help.github.com/articles/basic-writing-and-formatting-syntax/', sideEffects: 'cacheable', inputs: { mdString: { description: 'Markdown string to convert', example: '# hello world\n it\'s me, some markdown string \n\n ```js\n//but maybe i have code snippets too...\n```', required: true }, allowHtml: { friendlyName: 'Allow HTML?', description: 'Whether or not to allow HTML tags in the Markdown input. Defaults to `true`.', extendedDescription: 'If `false`, any input that contains HTML tags will trigger the `unsafeMarkdown` exit.', example: true, defaultsTo: true }, addIdsToHeadings: { friendlyName: 'Add IDs to headings?', description: 'Whether or not to add an ID attribute to rendered heading tags like
it's me, some markdown string
\n//but maybe i have code snippets too...\n'
},
unsafeMarkdown: {
friendlyName: 'Unsafe Markdown detected',
description: 'The provided input contained unsafe content (like HTML tags).'
}
},
fn: function(inputs, exits) {
var marked = require('marked');
// For full list of options, see:
// • https://github.com/chjj/marked
var markedOpts = {
gfm: true,
tables: true,
breaks: false,
pedantic: false,
smartLists: true,
smartypants: false,
};
if (inputs.addIdsToHeadings === true) {
var headingRenderer = new marked.Renderer();
headingRenderer.heading = function (text, level) {
var headingID = _.kebabCase(text);
return '