hackmdio / hackmdio/codimd

HTML is not parsed during PDF conversion

Open
#1,731 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
10.1k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

An example (problematic) note:

```markdown
Title
=====


Hello, world!

```

If I export such note to PDF, `div` block is copied into the output PDF as-is (without any parsing). This is because `markdown-pdf` is not configured to parse custom HTML. Is that behaviour intended?

If that is an unfortunate omission, the following changed should be enough to fix the issue.

```diff
diff --git i/lib/note/noteActions.js w/lib/note/noteActions.js
index 31f7c1f4..f583f0b1 100644
--- i/lib/note/noteActions.js
+++ w/lib/note/noteActions.js
@@ -79,7 +79,10 @@ function actionPDF (req, res, note) {
const pdfPath = config.tmpPath + '/' + Date.now() + '.pdf'
content = content.replace(/\]\(\//g, '](' + url + '/')
const markdownpdfOptions = {
- highlightCssPath: highlightCssPath
+ highlightCssPath: highlightCssPath,
+ remarkable: {
+ html: true
+ }
}
markdownpdf(markdownpdfOptions).from.string(content).to(pdfPath, function () {
if (!fs.existsSync(pdfPath)) {
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.