Reputation: 53
I'm curios is it possible to import md(mark down file) file in nodejs and use it as a string?
Question is very simple, how to use md file as a string in javascript (that's all)
Upvotes: 1
Views: 2626
Reputation: 53
I found the solution. This way u can import md file and use it as a string
import {readFileSync} from 'fs'
const markdownContent = readFileSync('apps/express/netlify/CHANGELOG.md', 'utf-8')
console.log(markdownContent, '||1||')
console.log('|||||||')
console.log(JSON.stringify(console.log(markdownContent)), ' heeeere')
Upvotes: 1