yzane / vscode-markdown-pdf

Markdown converter for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=yzane.markdown-pdf
Other
1.01k stars 206 forks source link

How to break page where images span pages ? #279

Closed SeaDude closed 2 years ago

SeaDude commented 2 years ago

Hello,

How do I automatically insert a page break where images span pages?

Example:

hackslashdave commented 2 years ago

I had a few issues with combining html and md - try this:

<div class="page"></div>
&zwj;
<table><tr><td><img src=""/></td></tr></table>
SeaDude commented 2 years ago

Thanks for the reply! I'm not exactly sure what you mean.

Here is the markdown shown in the screenshot above:

5. Click the `Media` tab on left screen 
6. Click `Upload` then select a logo from your machine
7. Set the `Image` property of `imgLogo` to the filename that was just uploaded

<table>
    <tr>
        <td style="border: 5px solid; border-collapse: collapse; padding:0px; border-color: #27ad74;">  
            <img src="assets/images/test.png"/> 
        </td>
    </tr>
</table>

Are you saying to insert a <div> tag and add &zwj above the <table>?

SeaDude commented 2 years ago

Apparently, that is exactly what you were saying (:)) because it worked!

image

image

Could you elaborate on how it works?

Thank you

SeaDude commented 2 years ago

Interesting!

hackslashdave commented 2 years ago

Ah, in the documentation they tell you to use:

<div class="page"/> for a page break.

I think somewhere in the code the class "page" is translated into css:

page-break-after: always;

But I found it needed the closing tag instead (</div>)

The &zwj; was after a bit of trial and error, &nbsp; gave an ugly space above the table so I looked into other "empty characters" to try and hack around that and discovered &zwj; myself - glad I could help