Add dingus
ci/woodpecker/push/woodpecker Pipeline was successful Details

This commit is contained in:
Sol Fisher Romanoff 2022-07-31 21:35:07 +03:00
parent 600dd77e50
commit cb12e3a149
Signed by: nbsp
GPG Key ID: 9D3F2B64F2341B62
2 changed files with 23 additions and 1 deletions

View File

@ -9,7 +9,8 @@
"lint": "eslint .",
"lint-fix": "eslint --fix .",
"test": "jest --verbose",
"build": "rollup -c rollup.config.umd.js"
"build": "rollup -c rollup.config.umd.js",
"dingus": "node ./src/dingus.js"
},
"repository": {
"type": "git",

21
src/dingus.js Normal file
View File

@ -0,0 +1,21 @@
import readline from 'readline'
import { marked } from 'marked'
import markedMfm from '../src/index.js'
const prompt = () => (new Promise((resolve) => {
const rl = readline.createInterface(process.stdin, process.stdout)
rl.question('> ', (input) => {
resolve(input)
rl.close()
})
}))
marked.use(markedMfm)
console.log('marked-mfm interactive parser')
console.log('version', process.env.npm_package_version)
while (true) {
const input = await prompt()
console.log(marked(input))
}