Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Markdown in Thymeleaf

Tags:

thymeleaf

What will be the best way to implement Markdown in Thymeleaf?

  • template mode
  • a new dialect (what processors?)

It would be useful if I can embed markdown in HTML.

like image 442
Adrian Ber Avatar asked Oct 19 '22 21:10

Adrian Ber


1 Answers

From what I understood from Javadoc, I will have to implement first the markdown enabler as an AbstractAttributeModelProcessor and use structureHandler.setLocalVariable to set that variable. Then I have to implement the markdown executor as an AbstractTextProcessor and in the doProcess method to test the variable using context.getVariable and if set to replace the text with a new one: text.setText(transformMarkdown(..)).

See more at https://github.com/thymeleaf/thymeleaf/issues/439.

like image 150
Adrian Ber Avatar answered Oct 27 '22 20:10

Adrian Ber