I am trying to generate .md
files by Nodejs, and the file should contain the front matter.
This is what I am doing:
let {title,date,markdown_content}=document;
let fileContent = `
---
title: '${title}'
date: ${date}
---
${markdown_content}
`;
Now the title
may contain special characters like "
'
and etc(find more in this post).
Any nodejs library can be used out of box to do this job? Or I will have to replace the characters manually.