N
Nuxt2mo ago
flomero

Proper way to target="_blank"

Whats the intended way of adding target="_blank" in nuxt content md files? if i do title{target="blank"} eslint adds a \ to escape title{target="_blank"} this breaks it. but i also dont want to exclude the files from linting 🤔
2 Replies
kapa.ai
kapa.ai2mo ago
Hi @flomero. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- The knowledge sources do not explicitly document the recommended way to add target="_blank" to Markdown links in Nuxt Content .md files. There is no mention of Markdown link syntax with {target="_blank"} or how to handle escaping issues with ESLint or other linters in the provided documentation. However, the Nuxt UI and NuxtLink components do support the target="_blank" attribute when used in Vue components or with their respective UI components, as shown in examples for components like UUser, UBlogPost, and UPageAnchors—but these are Vue templates, not Markdown files. For example:
<UUser
to="<https://github.com/benjamincanac">
target="_blank"
name="Benjamin Canac"
description="Software Engineer"
:avatar="{ src: '<https://github.com/benjamincanac.png'> }"
/>
<UUser
to="<https://github.com/benjamincanac">
target="_blank"
name="Benjamin Canac"
description="Software Engineer"
:avatar="{ src: '<https://github.com/benjamincanac.png'> }"
/>
User component link props For Markdown files, the knowledge sources do not provide a solution or workaround for the escaping issue you described with [title](url){target="_blank"} and ESLint. If you need to ensure external links open in a new tab and want to avoid linting issues, you may need to consult the Nuxt Content documentation or community for the latest best practices, as this is not covered in the provided sources. Summary:
There is no documented, supported way in the provided knowledge sources to add target="_blank" to Markdown links in Nuxt Content files or to resolve the escaping issue with linters. The sources only show how to use target="_blank" in Vue components and Nuxt UI components, not in Markdown content. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2mo ago
<@333278111326273537> Kapa.ai is still learning and improving, please let me know how I did by reacting below.

Did you find this page helpful?