vsch / flexmark-java

CommonMark/Markdown Java parser with source level AST. CommonMark 0.28, emulation of: pegdown, kramdown, markdown.pl, MultiMarkdown. With HTML to MD, MD to PDF, MD to DOCX conversion modules.
BSD 2-Clause "Simplified" License
2.26k stars 269 forks source link

FlexmarkHtmlConverter convert a html took 11.5 hrs,i donot known why #617

Open gujincun opened 3 months ago

gujincun commented 3 months ago

Describe the bug A clear and concise description of what the bug is.

Feel free to remove any sections that do not apply or add your own to clarify your issue.

Please provide as much information about where the bug is located or what you were using:

To Reproduce

If you can please provide sample code which exhibits the issue. This is always best because it incorporates a testable morsel which includes all relevant information.

Safelist whitelist = Safelist.basic().addTags("h1", "h2", "h3", "h4", "h5", "h6", "table", "tbody", "thead", "th", "tr", "td");
            // 保留的属性
            whitelist.addAttributes("th", "rowspan", "colspan");
            whitelist.addAttributes("td", "rowspan", "colspan");
            whitelist.addAttributes("code", "class");
            html = Jsoup.clean(html, whitelist);
            // 替换空格
            html = html.replaceAll(" "," ");

            MutableDataSet options = new MutableDataSet()
                    .set(FlexmarkHtmlConverter.BR_AS_PARA_BREAKS, false)
                    .set(FlexmarkHtmlConverter.BR_AS_EXTRA_BLANK_LINES, false)
                    .set(FlexmarkHtmlConverter.SETEXT_HEADINGS, false)
                    .set(FlexmarkHtmlConverter.SKIP_CHAR_ESCAPE, true);

            texts = Collections.singletonList(FlexmarkHtmlConverter.builder(options).build().convert(html));

Or a link to a sample code file.

If a code sample is not possible please provide as much of the following information as you can :

  1. Input text used Please provide a sample of text which causes the issue.

    Or provide a link to a file 54.zip

  2. Options used to configure the parser, renderer, formatter, etc. Please provide concise code when you can.

Expected behavior A clear and concise description of what you expected to happen with sample output that would be desired, where it makes sense.

Resulting Output It is best to provide one of the following (in decreasing order of value):

Additional context Add any other context about the problem here.

gujincun commented 3 months ago

html file is in apache-jmeter-5.3.zip\apache-jmeter-5.3\printable_docs\,you can get it directliy