naive-ui/doc/injectReadme.js
07akioni d6dc5eea7a feat(doc): make doc sync with readme.md
Create a script to convert and inject README.md to documentation.
Replace Emoji in this page with image from github. Because emoji
in Ubuntu is ridiculously ugly...
2019-07-10 14:08:16 +08:00

13 lines
433 B
JavaScript

const path = require('path')
const fs = require('fs')
const showdown = require('showdown')
const converter = new showdown.Converter({
tables: true
})
const text = fs.readFileSync(path.resolve(__dirname, '..', 'README.md')).toString()
const html = converter.makeHtml(text)
const htmlPath = path.resolve(__dirname, '../demo/readme.js')
fs.writeFileSync(htmlPath, 'export default `<div class="markdown-body">' + html + '</div>`\n')