Skip to content

Instantly share code, notes, and snippets.

@whitfin
Created March 30, 2016 00:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save whitfin/7a5172da4e62b231745e66fd0f094d62 to your computer and use it in GitHub Desktop.
Save whitfin/7a5172da4e62b231745e66fd0f094d62 to your computer and use it in GitHub Desktop.
exports.parse = function parse(mdown) {
console.log('<p align="center" style="margin: 2em auto auto auto; width:70%;">');
mdown.match(/\[\!.*?\)\].*?\)/g).forEach(function (badge) {
var segments = badge.match(/\[!\[(.*?)\]\((.*?)\)\]\((.*?)\)/);
var altText = segments[1];
var svgPath = segments[2];
var urlHref = segments[3];
console.log(` <a href="${urlHref}">`);
console.log(` <img src="${svgPath}" alt="${altText}" />`);
console.log(` </a>`);
});
console.log('</p>')
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment