Describe the bug
Rendering HTML to Markdown using FlexmarkHtmlParser.parse() ignores anchors in which the href value equals the wrapped value, thus ignoring a potential useful link being generated.
To Reproduce
This sample codes converts HTML to Markdown using the example approach detailed here:
String originalText = "<p>This doesn't get rendered: <a href=\"https://google.com\" rel=\"nofollow\">https://google.com</a> <a href=\"https://google.com\" rel=\"nofollow\">This does.</a></p> \n";
String output = FlexmarkHtmlParser.parse(originalText);
Expected behavior: the first anchor should be rendered to a Markdown link.
Resulting Output: it just gets transformed to text.
Additional context: to fix this issue, the following approach has been employed:
String originalText = "<p>This doesn't get rendered: <a href=\"https://google.com\" rel=\"nofollow\">https://google.com</a> <a href=\"https://google.com\" rel=\"nofollow\">This does.</a></p> \n";
String output = FlexmarkHtmlParser.parse(
originalText,
1,
new MutableDataSet()
.set(FlexmarkHtmlParser.WRAP_AUTO_LINKS, true)
);
Setting FlexmarkHtmlParser.WRAP_AUTO_LINKS to true renders the anchor successfully.
Describe the bug
Rendering HTML to Markdown using
FlexmarkHtmlParser.parse()ignores anchors in which thehrefvalue equals the wrapped value, thus ignoring a potential useful link being generated.ParserHtmlRendererFormatterFlexmarkHtmlParserDocxRendererPdfConverterExtensionTo Reproduce
This sample codes converts HTML to Markdown using the example approach detailed here:
Expected behavior: the first anchor should be rendered to a Markdown link.
Resulting Output: it just gets transformed to text.
Additional context: to fix this issue, the following approach has been employed:
Setting
FlexmarkHtmlParser.WRAP_AUTO_LINKSto true renders the anchor successfully.