markdown-wasm/test/spec/spec.js
Rasmus Andersson 96d9547723 adds test/spec
2020-10-15 13:53:03 -07:00

28 lines
706 B
JavaScript

const fs = require("fs")
const markdown = require('../../dist/markdown.node.js')
const { exit } = require("../testutil")
// https://spec.commonmark.org
const source = fs.readFileSync(__dirname + "/spec.md")
const timeLabel = `markdown.parse("spec.md")`
console.time(timeLabel)
let html = markdown.parse(source)
console.timeEnd(timeLabel)
html = `
<html lang="en">
<head>
<meta charset="utf-8">
<title>Markdown spec</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<body>
${html}
</body>
</html>
`.trim()
const outfile = __dirname + "/spec.html"
fs.writeFileSync(outfile, html, "utf8")
exit()