manuth / MarkdownConverter

Provides the functionallity to convert Markdown-files to html, png, or pdf using vscode.
MIT License
37 stars 11 forks source link

Convert images to base64 when printing to HTML #220

Closed yusisushi closed 11 months ago

yusisushi commented 11 months ago

Proposal

When printing to HTML convert images to base64 string. This makes it so that the exported .html document can be shared without loosing the images if the path in the html file is not reachable.

Other information

This feature exists in another extension called "markdown-all-in-one"

manuth commented 11 months ago

Hello @yusisushi Thank you so much for your recommendation.

This feature indeed already exists in MarkdownConverter.

The setting for configuring the image conversion is called markdownConverter.Assets.PictureInsertion. In this setting, you can set the conversion for links (markdownConverter.Assets.PictureInsertion.Link), relative paths (markdownConverter.Assets.PictureInsertion.RelativePath) and absolute paths (markdownConverter.Assets.PictureInsertion.AbsolutePath).

In order to have all pictures included using Base64, set these settings to Include:

{
    "markdownConverter.Assets.PictureInsertion": {
        "Link": "Include",
        "RelativePath": "Include",
        "AbsolutePath": "Include"
    }
}

Looking at this, however, makes me feel like it might make sense to also have a setting like markdownConverter.Assets.PictureInsertion.Default for overriding the default behavior.

Furthermore, I think this setting should be more prominently highlighted in the README. For that reason, I will keep this issue open for now.

Thanks for showing interest in my project, I appreciate it ✨

yusisushi commented 11 months ago

Hello @yusisushi Thank you so much for your recommendation.

This feature indeed already exists in MarkdownConverter. ...

Wow, thanks for the quick reply! I'm very glad to discover this feature has indeed been implemented already.

The settings you refer to resolved it for me.

Your project is great, it's the only extension that outputs html with an elegant style i.m.o.