vscode-markdown-pdf icon indicating copy to clipboard operation
vscode-markdown-pdf copied to clipboard

Export PDF produces different HTML than Export HTML.

Open raiden-e opened this issue 5 months ago • 0 comments

So I found this out when I noticed that some styles from my local CSS were only applied in the browser, and not in the PDF (or JPG).

Here is a short test .md file with some html:

<div class="title">

# this is a test document

According to the css, this text should be written in the font "Inter".

</div>

# However

this text should be written in the font "Comic Sans MS".

The Browser displays the texts as expected.

The PDF does not. Nor does a jpeg of the PDF.

Apply this CSS:

body { font-family: "Comic Sans MS"; }
.title p { font-family: "Inter"; }

In the "Export HTML"-HTML, the div with the class "test" is closed by the </div>.

When running the export PDF command, a temporary HTML is produced. I renamed it, before the process could finish and found that for whatever reason, the div was closed immediately, leading unstyled, uncool text.

Here is the result (I got it from the files I tested it with, so the content is a bit different, the main part is the immediately closed div container):

<div class="title">
</div><h1 id="hauptseite">Hauptseite</h1>
<p>Dies ist die Titelseite. Dieser Text wird in der Schrift &quot;Inter&quot; geschrieben.</p>

Perhaps a different export function is used, or the export function has other caveats?

Please help 👍

raiden-e avatar Sep 27 '24 13:09 raiden-e