Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flexmark-html-parser - multiple <code> inside <pre> bug #326

Closed
tchudyk opened this issue Mar 14, 2019 · 3 comments
Closed

flexmark-html-parser - multiple <code> inside <pre> bug #326

tchudyk opened this issue Mar 14, 2019 · 3 comments

Comments

@tchudyk
Copy link

tchudyk commented Mar 14, 2019

Hi, I'd like to report bug in HTML to Markdown converter.
When in <pre> block is more then one <code> node, then in converted output we have only value from first <code> node, all other nodes inside this <pre> block are lost.

Problem seems important for me here, because we losing part of data (its not only mistake in formatting).

Sample input:

<pre><code>casa</code><br><code>asdf</code><br>ffdd</pre>

Output for this input:

    casa

Expected:

   casa
   asdf
   ffdd

My usage of parser:

        MutableDataSet dataSet = new MutableDataSet();
        dataSet.set(FlexmarkHtmlParser.RENDER_COMMENTS, false);
        dataSet.set(FlexmarkHtmlParser.SETEXT_HEADINGS, false);
        dataSet.set(FlexmarkHtmlParser.THEMATIC_BREAK, "---");
        dataSet.set(FlexmarkHtmlParser.SKIP_CHAR_ESCAPE, true);
        dataSet.set(FlexmarkHtmlParser.BR_AS_PARA_BREAKS, true);
        dataSet.set(FlexmarkHtmlParser.LISTS_END_ON_DOUBLE_BLANK, false);
        dataSet.set(FlexmarkHtmlParser.UNORDERED_LIST_DELIMITER, '-');
        dataSet.set(FlexmarkHtmlParser.LIST_CONTENT_INDENT, true);
        dataSet.set(FlexmarkHtmlParser.NBSP_TEXT, " ");
        dataSet.set(FlexmarkHtmlParser.PRE_CODE_PRESERVE_EMPHASIS, false);
        dataSet.set(FlexmarkHtmlParser.OUTPUT_UNKNOWN_TAGS, true);

        parser = FlexmarkHtmlParser.build(dataSet);
        StringWriter sw = new StringWriter();
        MarkdownWriter markdownWriter = new MarkdownWriter(sw);
        parser.parse(markdownWriter, input);
        return markdownWriter.getText()
@vsch vsch added the 🪲 bug label Mar 14, 2019
@vsch vsch added this to the V 0.40.24 milestone Mar 14, 2019
@vsch
Copy link
Owner

vsch commented Mar 14, 2019

@tchudyk, bug. I'll fix it and make a release.

@vsch
Copy link
Owner

vsch commented Mar 14, 2019

Fix for this is available. Repo updated, maven updated but may take a while to show up in maven central.

@tchudyk
Copy link
Author

tchudyk commented Mar 15, 2019

Wow, that was quick. Fixed, thanks.

@vsch vsch closed this as completed Mar 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants