Contentful logo

Contentful Community

Markdown open a link in a new tab

Hello,
I’m wondering if it’s possible to open a link in a new tab using built-in Markdown in contentful.
I tried some code like

[link](url){:target="_blank"}

but it’s not working.
Some people said it’s not possible to do it.
Is it correct?

Indeed Markdown has no standard way of adding additional attributes like target.

You could either use HTML directly, or modify your Markdown parser to emit target="_blank". You could do this conditionally based on the URL, e.g. only for external links.

I’ve posted earlier how to accomplish this with Rich Text, the same principle should apply to Markdown.