Skip to content

Instantly share code, notes, and snippets.

@odoe
Created April 25, 2019 15:55
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 odoe/c57b8e0e6c584a82acb74588d3007ec5 to your computer and use it in GitHub Desktop.
Save odoe/c57b8e0e6c584a82acb74588d3007ec5 to your computer and use it in GitHub Desktop.
import * as fs from 'fs';
import { resolve } from 'path';
import { Converter } from 'showdown';
const mdConverter = new Converter();
export default function (path: string) {
path = resolve(__dirname, path);
const file = fs.readFileSync(path, 'utf8');
// convert Markdown to HTML
const html = mdConverter.makeHtml(file);
return html
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment