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.29k stars 272 forks source link

How to have square brackets in output without being parsed as a LinkRef #460

Closed kemitix closed 3 years ago

kemitix commented 3 years ago

I have a source document that contains a phrase like:

Some text [with text in square brackets] that is not a link.

When parsed, this is interpreted as a LinkRef. How do I tell flexmark to treat it as plain text?

Thanks

vsch commented 3 years ago

Use the standard markdown escape \ before the leading [ to have it interpreted as a plain text.

kemitix commented 3 years ago

@vsch Thanks. I think I'd been trying to escape both open and close braces.

noahmoss commented 2 years ago

@vsch Is this not a bug? It seems that escaping should not be required, at least according to the CommonMark spec. This example works, in addition.

I am running into this issue as well but escaping is not an option as I do not have control of the Markdown input.