Maren Core
Maren is a theme based markdown renderer. It renders markdown to html by using a theme.
Theme can be developed by any tools. It is completely separated from Maren to allow easy and rich customization.
Install
npm install maren-core
API
const render loadTheme basicTheme } = ;
render
/** * Render markdownString to html by using a theme. * * @param * @param * @param * @param * @param * @param * @param * * @return */ { /* */ }
loadTheme
/** * Load theme from themeLocation. * Required file: themeLocation/template.js * Optional file: themeLocation/options.json * * @param * * @return * @return */ { /* */ }
basicTheme
console;/*{ name: 'basic', location: '.../maren-core/themes/basic', template: [Function], options: {} }*/
Theme
const theme = // required // should be compiled render function, but can be other data // optional // can modify data in any way, don't forget to return new data { console; return data; } // optional // should contain minified and hashed styles and scripts options: styles: "styles-a8945f9ff83852c0da4d9b56dc0b50fd.css" scripts: "scripts-a73c5dd921d5f33f040f5f51890f04af.js" // if theme is not manually created, but loaded using loadTheme, // it will also have "name" and "location" like basicTheme;
Use
Dummy theme
const render = ; /* your markdown string */const markdown = '# Article'; /* your theme */const theme = /* required */ { /* template can render data using template library of choice (pug, ejs, handlebars, mustache, or other) or simply return data as is */ return data; } /* not required */ options: undefined beforeRender: undefined; /* output depends on the theme */const output = ; console;/*{ meta: { title: 'Article', toc: undefined }, html: '<h1 id="article">Article</h1>\n', options: undefined }*/
Basic theme
const render basicTheme = ; /* your markdown string */const markdown = '# Article'; /* output depends on the theme */const output = ; console;/*<html>...</html>*/
Tests
npm test