Skip to content

Commit 1360a00

Browse files
committed
v2.5.29
See #247
1 parent fed75a0 commit 1360a00

File tree

6 files changed

+12
-5
lines changed

6 files changed

+12
-5
lines changed

browser.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/browser-2.5.28.js renamed to docs/browser-2.5.29.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ <h1>HTML to PDFMake convertor</h1>
116116
<div id="pdf_ie" style="display:none;padding:3em">The PDF file is sent to you for download. Use a modern browser (like Chrome or Firefox) to display the PDF in this page.</div>
117117
</div>
118118
</div>
119-
<script src="browser-2.5.28.js"></script>
119+
<script src="browser-2.5.29.js"></script>
120120
<script src="https://cdn.jsdelivr.net/npm/pdfmake@latest/build/pdfmake.min.js"></script>
121121
<script src="https://cdn.jsdelivr.net/npm/pdfmake@latest/build/vfs_fonts.js"></script>
122122
<script>

example.pdf

0 Bytes
Binary file not shown.

index.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,14 +586,21 @@ function htmlToPdfMake(htmlText, options) {
586586
// handle custom tags
587587
ret = options.customTag.call(this, {element:element, parents:parents, ret:ret});
588588
}
589+
589590
}
590591
}
591-
592+
592593
// reduce the number of JSON properties
593594
if (Array.isArray(ret.text) && ret.text.length === 1 && ret.text[0].text && !ret.text[0].nodeName) {
594595
ret.text = ret.text[0].text;
595596
}
596597

598+
// if we are inside <LI> and the text is just empty, PDFMake will ignore it (see https://github.com/Aymkdn/html-to-pdfmake/issues/247)
599+
if (parents.length > 0 && parents[parents.length-1].nodeName === "LI" && ((Array.isArray(ret.text) && ret.text.length === 0) || (typeof ret.text === 'string' && ret.text === ''))) {
600+
// so we replace it with a space
601+
ret.text = ' ';
602+
}
603+
597604
// check if we have some data-pdfmake to apply
598605
if (['HR','TABLE'].indexOf(nodeName) === -1 && element.dataset && element.dataset.pdfmake) {
599606
// handle when people will use simple quotes

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "html-to-pdfmake",
3-
"version": "2.5.28",
3+
"version": "2.5.29",
44
"description": "Convert HTML code to PDFMake",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)