flexmark-java icon indicating copy to clipboard operation
flexmark-java copied to clipboard

how to insert node before Paragraph node? eg <div> <p> some text</p> </div>?

Open apri30th opened this issue 6 years ago • 3 comments

i have read the NodeInsertingPostProcessorSample . in this sample, it can insert img node after p node
but how can i insert html tag before the p node ? eg . <'div'> <'p'> some txt <'/p'> <'/div'> or <'span'> <'p'> some text<'/p'> <'/span'> ?

what kind of div or span tag defined in node ? is it htmlblock node ?
if so ,how can i use htmlblock node ?

apri30th avatar Apr 27 '19 13:04 apri30th

@apri30th, what you want needs a custom renderer instead of modifying the AST which will wrap the paragraph in a div tags.

I added a sample to do exactly what you described in ParagraphCustomRenderingSample.java

Input:

text

Rendered result:

<div>
<p>text</p>
</div>

vsch avatar Apr 27 '19 18:04 vsch

@vsch thank you very much for your timely reply ! i will try it later .
again ,thanks.

apri30th avatar Apr 29 '19 08:04 apri30th

@apri30th if the issue has been resolved, please close the ticket. Otherwise, please add more details about the problem you've encountered.

ghost avatar Jun 20 '23 01:06 ghost