alanshaw / alanshaw/markdown-pdf
Render problem with new lines
- 主要语言
- JavaScript
- 星标
- 2.9k
- 派生
- 253
- PR 合并指标
- 30 天内没有已合并 PR
描述
Hi everyone,
I try to convert this string:
`
**Hi**\n##This is a title
`
into a PDF. But the result is:

Seems **\n** are not parsed.
My code is:
```
/**
* Convert markdown string to buffer
*
* @param {String} body The Content body
* @returns {Promise}
*/
const asMarkdown = body => {
const markdownpdf = require('markdown-pdf')
console.log(body)
return new Promise((resolve, reject) => {
return markdownpdf()
.from.string(body)
.to.buffer({}, (err, buffer) => {
if (err) {
reject(err)
} else {
resolve(buffer)
}
})
})
}
```
There is something missing in my code (for example in options buffer) or the issue is another?
I've take inspiration from the example in the README project directory:
```
var markdownpdf = require("markdown-pdf")
var md = "foo===\n* bar\n* baz\n\nLorem ipsum dolor sit"
, outputPath = "/path/to/doc.pdf"
markdownpdf().from.string(md).to(outputPath, function () {
console.log("Created", outputPath)
})
```
with the difference that my output is a buffer and not a path file.
贡献指南
这个仓库没有索引到贡献指南
评估
这个 Issue 还没有评估数据。