jarontai / html2md

A library for converting HTML to Markdown in Dart. It supports CommonMark, simple table and custom converting rules. 将html转换为markdown的Dart库,支持CommonMark、简单表格以及自定义转换规则。
https://pub.dev/packages/html2md
BSD 2-Clause "Simplified" License
58 stars 25 forks source link

Converting an <img> to md style #48

Open JAZ-CO opened 2 months ago

JAZ-CO commented 2 months ago

When trying to use this package for images, it always gives me a text instead of rendering the image,

For example:

If the markdown data was: "![Sample Image](https://github.githubassets.com/images/modules/logos_page/GitHub-Logo.png)", It will perfectly show an image

but when trying to use an or even converting an already markdown style,

Example: html2md.convert("![Sample Image](https://github.githubassets.com/images/modules/logos_page/GitHub-Logo.png)")<

It will just show it as a text instead of loading the image

JAZ-CO commented 2 months ago

This solved the issue for me, to remove all escape characters:

html2md.convert(\'![Sample Image](https://github.githubassets.com/images/modules/logos_page/GitHub-Logo.png)').replaceAll("\", "")