Skip to content

Commit

Permalink
fix(pdf) headings can now contain different kinds of things
Browse files Browse the repository at this point in the history
Signed-off-by: Jerome Simeon <[email protected]>
  • Loading branch information
jeromesimeon committed Sep 21, 2020
1 parent 15b6a10 commit 063bdeb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 2 additions & 4 deletions packages/markdown-pdf/src/ToPdfMakeVisitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,11 +236,9 @@ class ToPdfMakeVisitor {
}
break;
case 'Heading': {
const child = this.processChildNodes(thing,parameters);
const text = child && child[0] && child[0].text ? child[0].text : '';
result.style = ToPdfMakeVisitor.getHeadingType(thing);
result.text = `\n${text}\n`;
result.tocItem = text.length > 0 ? true : false;
result.text = this.processChildNodes(thing,parameters);
result.tocItem = thing.nodes && thing.nodes.length > 0 ? true : false;
}
break;
case 'ThematicBreak': {
Expand Down
5 changes: 5 additions & 0 deletions packages/markdown-pdf/test/data/contract.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Title (Heading One)

Title2
*(Heading Two)*
**on several lines**
----

This is normal text.

This is *italic* text.
Expand Down

0 comments on commit 063bdeb

Please sign in to comment.