#prevent automatic email address linking

3 messages · Page 1 of 1 (latest)

pearl dove
#

how do i stop the markdown processor from automatically turning [email protected] in to a clickable email address?

sick craterBOT
#

Hi @pearl dove. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

To prevent Markdown from automatically turning email addresses like [email protected] into clickable links, you have a few options in Astro:

Option 1: Escape special characters

You can escape the @ symbol in your email address using HTML entities:

hello@example.com

As mentioned in the Astro documentation, certain characters have special meaning in Markdown, and you can use HTML entities to display them without triggering their special functionality:

Troubleshooting Guide

Option 2: Disable GitHub-Flavored Markdown

Astro uses GitHub-Flavored Markdown (GFM) by default, which includes automatic URL and email linking. You can disable this feature in your astro.config.mjs file:

export default defineConfig({
  markdown: {
    gfm: false,
  }
});

This will disable all GitHub-Flavored Markdown features, including automatic email linking:

Configuration Reference

Option 3: Use a custom remark plugin

If you want more fine-grained control, you could create a custom remark plugin that specifically prevents email auto-linking while keeping other GFM features.

Choose the option that best fits your needs - using HTML entities is simplest for occasional cases, while disabling GFM is better if you want to prevent all automatic linking throughout your site.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: