flexmark-java
flexmark-java copied to clipboard
Concat words without splitter when more then one `\n` provided
To Reproduce
String raw = new TextCollectingVisitor().collectAndGetText(
Parser.builder().build().parse("Hello\n\nworld")
);
System.out.println(raw); // Helloworld
Expected behavior
System.out.println(raw);
Hello
world
@nikialeksey, the old use case was limited to extracting inline nodes, which I agree is useless for the general case.
The next release has this fixed so you will get the result you are looking for and there is also a TableTextCollectingVisitor
which extends text collecting visitor to extract table header and body columns, adds line breaks after table rows and a blank line after each table.
I will be making a release in short order.
@nikialeksey, fix for this is available. Repo updated, maven updated but may take a while to show up in maven central.
@vsch Cool! I will check it today. Thanks!
@vsch Works correclty! Thanks for the fast response.
@vsch Hi!
Reproduced again on a version 0.62.2
, but with other inputs:
val raw = TextCollectingVisitor().collectAndGetText(
Parser.builder().build().parse("## Hello\n\n## world")
)
println(raw) // Helloworld
Expected:
Hello
world