#Can i add more custom markdown syntax ? Like :::tip :::danger

1 messages · Page 1 of 1 (latest)

patent crag
#

How can i create my own cutom markdown blocks using a pair of triple colons ::: i need one for :::do and :::dont

hollow spindleBOT
#

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

#

Astro uses Starlight's custom Markdown syntax for rendering asides, which are blocks of content indicated using a pair of triple colons :::. The types of asides currently supported are note, tip, caution, and danger source (https://starlight.astro.build/guides/authoring-content/#asides).

However, the provided sources do not specify a way to create custom aside types like :::do and :::dont.

Astro does support adding third-party remark and rehype plugins for Markdown, which allow you to extend your Markdown with new capabilities source (https://docs.astro.build/en/guides/markdown-content/#adding-remark-and-rehype-plugins). You might be able to find or create a plugin that allows for additional custom syntax.

If you want to extend the Markdown capabilities, you can add remarkPlugins or rehypePlugins in your Astro config file. Here's an example of how to do it:

import { defineConfig } from 'astro/config';
import remarkToc from 'remark-toc';
import { rehypeAccessibleEmojis } from 'rehype-accessible-emojis';

export default defineConfig({
  markdown: {
    remarkPlugins: [ [remarkToc, { heading: 'toc', maxDepth: 3 } ] ],
    rehypePlugins: [rehypeAccessibleEmojis],
  },
});

source (https://docs.astro.build/en/guides/markdown-content/#adding-remark-and-rehype-plugins)

For more specific customization, you might need to refer to the documentation of the remark and rehype plugins or the Astro documentation.

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