Steppschuh / Java-Markdown-Generator

Java library to generate markdown
MIT License
230 stars 47 forks source link

BoldText and so on does not escape markdown special characters #20

Open Qworel97 opened 3 years ago

Qworel97 commented 3 years ago

Imaging you have code like this

new ItalicText("*italic*")

After processing you will receive

italic

The issue is that when we pass any data that can be seen as markdown string we receive strange behaviour

.replaceAll("([*_~>#-.\\[\\]()|`])", "\\\\$1")

Something like that should do that trick, but adding it by default into BoldText and others will make user depend only on styling tools provided by library, so instead it would be nice to have possibility to write something like

new IgnoreMarkdownText("*italic*")

And receive output like

\*italic\*

Thanks in advance