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

Bug: Image inclusion in nested markdown document

Open thepian opened this issue 3 years ago • 2 comments

Images in sub-documents don't seem to be correctly located. It generates a broken Image + Alt-text.

a.md

## Heading

:[Sub-document](../b/b.md)

b.md

## Heading

![Image](./c.jpg)

thepian avatar Dec 30 '21 09:12 thepian

Really would like this feature. Just as an implementation idea, potentially the images could be converted to base64 and then embedded in the doc.

Not really sure about the PDF format, but that should work for html. It would make the html file really large, but it could be an easy first step and as a benefit to get PDFs, once that was complete you could use the browser 'print to pdf' function.

If this is your flow to get a pdf, then the size of the file size is not important.

ralphsmith80 avatar Dec 07 '22 14:12 ralphsmith80

@thepian I just realized this does work, but I was making a silly error. If you use must use a relative path not an absolute path.

These both work: ![Image](./c.jpg) ![Image](c.jpg)

but not this: ![Image](/c.jpg)

If that still doesn't work for you, I also used a node module markdown-pdf which is when I realized my error.

This was the convertToPdf.js script I made to use that.

var markdownpdf = require('markdown-pdf')
var fs = require('fs')

markdownpdf()
  .from('README.md')
  .to('README.pdf', function () {
    console.log('Done')
  })

ralphsmith80 avatar Dec 07 '22 15:12 ralphsmith80