I am trying to develop a plugin to export markdown file to PDF.
Here is a sample markdown content:
# What is Obsidian ?
Obsidian is a **markdown** editor.
I am using marked library to convert markdown => html string after which using html function of JSPDF library to convert to PDF and save
The code snippet is as follows:
const pdf = new jsPDF()
//converting markDown text to html
const htmlContent = await marked(markedDownContent);
pdf.html(htmlContent, {
callback: (doc) => {
doc.save("output.pdf");
},
x: 0,
y: 0,
margin: 10
});
However, the text generated in PDF is poorly formatted as seen below:
I need help in fixing the styling of the text generated in the PDF document.
Edit
As mentioned in the comments, the html generated is as follows:
<h1>What is Obsidian ?</h1>
<p>Obsidian is a <strong>markdown</strong> editor.</p>
