const { writeFile } = require('fs/promises')
const { createReadStream } = require('fs')
const { createInterface } = require('readline')
const data = `
---
hello: world
foo: bar
---
hello: world
---
# Some article title
> "hello world"
> "foo bar"
`
async function main() {
await writeFile('tmp.md', data)
const stream = createReadStream('tmp.md', 'utf-8')
const rl = createInterface({ input: stream, crlfDelay: Infinity })
for await (const line of rl) {
console.log(line)
}
stream.close()
}
main()
To embed this program on your website, copy the following code and paste it into your website's HTML: