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.21k stars 260 forks source link

need help ,table cell content line break break document #582

Open sdhjl2000 opened 1 year ago

sdhjl2000 commented 1 year ago
MutableDataSet options = new MutableDataSet();
        options.setFrom(ParserEmulationProfile.MARKDOWN);
        options.set(Parser.EXTENSIONS, Lists.newArrayList(com.vladsch.flexmark.ext.tables.TablesExtension.create()));
        options.set(TablesExtension.FORMAT_TABLE_TRIM_CELL_WHITESPACE, true);
        Parser parser = Parser.builder(options).build();
        Node document = parser.parse(markdown);
        List<String> paragraphs=new ArrayList<>();
for (Node node = document.getFirstChild(); node != null; node = node.getNext()) {
            if (node instanceof Paragraph) {
                paragraphs.add(node.getChars().toString());
            }
            if (node instanceof TableBlock) {
             }

if table cell content contains two line break "\n", content after line break recognition as Paragraph