# Markdown (/start/markup-markdown)



<Accordions>
  <Accordion title="What is Markdown?" id="what-is-markdown">
    **Markdown** is a lightweight markup language for creating formatted text using a plain-text editor. John Gruber created Markdown in 2004, in collaboration with Aaron Swartz, as a markup language that is intended to be easy to read in its source code form. Markdown is widely used for blogging and instant messaging, and also used elsewhere in online forums, collaborative software, documentation pages, and readme files.
  </Accordion>
</Accordions>

Pixi’VN is not tied to any markup, and gives the developer the ability to choose the markup they prefer. However, it is recommended to use Markdown.

<CalloutContainer type="info">
  <CalloutTitle>
    Templates
  </CalloutTitle>

  <CalloutDescription>
    In all templates, the Markdown component is already defined.
  </CalloutDescription>
</CalloutContainer>

<CalloutContainer type="info">
  <CalloutTitle>
    *ink*
  </CalloutTitle>

  <CalloutDescription>
    You can use this method with the *ink* syntax. See more <DynamicLink href="/ink/markup#markdown">here</DynamicLink>.
  </CalloutDescription>
</CalloutContainer>

Here are some examples of implementations of Markdown in the JavaScript ecosystem:

<CodeBlockTabs defaultValue="React">
  <CodeBlockTabsList>
    <CodeBlockTabsTrigger value="React">
      React
    </CodeBlockTabsTrigger>

    <CodeBlockTabsTrigger value="Vue">
      Vue
    </CodeBlockTabsTrigger>

    <CodeBlockTabsTrigger value="Svelte">
      Svelte
    </CodeBlockTabsTrigger>

    <CodeBlockTabsTrigger value="Angular">
      Angular
    </CodeBlockTabsTrigger>
  </CodeBlockTabsList>

  <CodeBlockTab value="React">
    ```tsx
    // I use the @tanstack/markdown library to convert the Markdown to HTML
    // read more about it here: https://www.npmjs.com/package/@tanstack/markdown
    // Tables, strikethrough and task lists (GFM) are supported out of the box,
    // `allowHtml` enables raw HTML (e.g. <span style="color:blue">...</span>).
    import { Markdown } from "@tanstack/markdown/react";

    export default function MarkdownComponent({ text }: { text: string }) {
        return <Markdown allowHtml>{text}</Markdown>;
    }
    ```
  </CodeBlockTab>

  <CodeBlockTab value="Vue">
    ```vue
    <!-- I use the vue-markdown-render library to convert the Markdown to HTML -->
    <!-- read more about it here: https://www.npmjs.com/package/vue-markdown-render -->
    <template>
        <div>
            <vue-markdown :source="src" />
        </div>
    </template>

    <script lang="ts">
    import VueMarkdown from 'vue-markdown-render'

    export default defineComponent({
      name: 'MyComponent',
      components: {
        VueMarkdown
      },
      setup(props, ctx) {
        const src = ref('---
    title: header')
    ---

        return {
          src
        }
      }
    })
    </script>
    ```
  </CodeBlockTab>

  <CodeBlockTab value="Svelte">
    ```svelte
    <!-- I use the svelte-markdown library to convert the Markdown to HTML -->
    <!-- read more about it here: https://www.npmjs.com/package/svelte-markdown -->
    <script>
      import SvelteMarkdown from 'svelte-markdown'
      const source = `
      ---
    title: This is a header
    ---

    This is a paragraph.

    * This is a list
    * With two items
      1. And a sublist
      2. That is ordered
        * With another
        * Sublist inside

    | And this is | A table |
    |-------------|---------|
    | With two    | columns |`
    </script>

    <SvelteMarkdown {source} />
    ```
  </CodeBlockTab>

  <CodeBlockTab value="Angular">
    ```tsx
    // I use the ngx-markdown library to convert the Markdown to HTML
    // read more about it here: https://www.npmjs.com/package/ngx-markdown
    import { Component, Input } from "@angular/core";
    import { MarkdownModule } from "ngx-markdown";

    @Component({
        selector: "app-markdown",
        template: ` <markdown [data]="text"></markdown> `,
    })
    export class MarkdownComponent {
        @Input() text: string;
    }
    ```
  </CodeBlockTab>
</CodeBlockTabs>

<Sandbox template="4h8wst" entry="/src/components/MarkdownComponent.tsx" previewHeight="300" />

## Markdown Typewriter [#markdown-typewriter]

[Markdown Typewriter](https://www.npmjs.com/package/markdown-typewriter) is a library that combines Markdown and Typewriter. This library was created by me for my need to add a Typewriter effect to the Markdown component in my React templates.

It renders Markdown with [@tanstack/markdown](https://tanstack.com/markdown) and accepts its props. With `allowHtml`, raw HTML is typed out too, keeping its attributes: `<span style="color:blue">...</span>` is blue while it appears.

```bash
npm install markdown-typewriter motion @tanstack/markdown
```

```tsx title="React"
import { MarkdownTypewriter } from "markdown-typewriter/react";

export default function MarkdownComponent({ text }: { text: string }) {
    return <MarkdownTypewriter allowHtml>{text}</MarkdownTypewriter>;
}
```

<Sandbox template="rgjf6t" entry="/src/components/MarkdownComponent.tsx" previewHeight="320" />
