Getting Started

Installation

Install Comark and render your first Markdown with components in Vue, React, or plain HTML in under 5 minutes.

Install Comark

Add comark to your project with your package manager of choice depending on your framework.

pnpm add @comark/vue

Quick Start

Pick your framework and get rendering in seconds.

Vue

App.vue
<script setup lang="ts">
import { Comark } from '@comark/vue'
import Alert from './components/Alert.vue'

const content = `# Hello World

This is **markdown** with a custom component:

::alert{type="info"}
Welcome to Comark!
::
`
</script>

<template>
  <Suspense>
    <Comark :components="{ Alert }">{{ content }}</Comark>
  </Suspense>
</template>
When using async plugins (like syntax highlighting), wrap <Comark> in a <Suspense> component. See Vue Rendering for details.

Learn more about Vue Rendering.

React

Use the components prop to pass your custom components to the <Comark> component.

App.tsx
import { Comark } from '@comark/react'
import Alert from './Alert.tsx'

const content = `# Hello World

This is **markdown** with Comark components.

::alert{type="info"}
This is an alert!
::
`

export default function App() {
  return <Comark components={{ Alert }}>{content}</Comark>
}

Learn more about React Rendering.

HTML (No Framework)

For server-side rendering or static generation without a framework:

import { parse } from 'comark'
import { renderHTML } from 'comark/string'

const tree = await parse(`# Hello World

This is **markdown** with a custom component:

::alert{type="info"}
Welcome to Comark!
::
`)

const html = renderHTML(tree)
console.log(html)

Use the components option in renderHTML to control how custom components are rendered to HTML. See HTML Rendering for details.

Next Steps

Components

Learn the component syntax for blocks, inline elements, props, and slots

Attributes

Add classes, IDs, and custom attributes to Markdown elements

Vue Rendering

Full Vue integration with custom components and streaming

React Rendering

Full React integration with custom components

Plugins

Add syntax highlighting, math, mermaid diagrams, and more

Parse API

Detailed parsing options, streaming, and error handling
Copyright © 2026