---
title: "Markdown"
description: "Comark supports all standard CommonMark and GitHub Flavored Markdown (GFM) features including headings, formatting, lists, tables, code blocks, and more."
canonical_url: "https://docs-template.comark.dev/writing/markdown"
---
# Markdown

> Comark supports all standard CommonMark and GitHub Flavored Markdown (GFM) features including headings, formatting, lists, tables, code blocks, and more.

Pages are parsed with [Comark](https://comark.dev), which supports all standard CommonMark and GitHub Flavored Markdown (GFM) features. This page covers the plain Markdown syntax; see [Components](https://docs-template.comark.dev/writing/components) for callouts, tabs, and other block components.

## Headings

```md
# Heading 1
## Heading 2
### Heading 3
#### Heading 4
##### Heading 5
###### Heading 6
```

All headings automatically get ID attributes generated from their content for linking:

```mdc
# Hello World
<!-- Becomes: <h1 id="hello-world">Hello World</h1> -->
```

## Text Formatting

<code-preview>
<div>
**Bold text**   

*Italic text*   

***Bold and italic***   

~~Strikethrough~~   

`Inline code`
</div>

#code
```mdc
**Bold text**
*Italic text*
***Bold and italic***
~~Strikethrough~~
`Inline code`
```
</code-preview>

<callout>
Text nodes in Comark are simple strings, similar to HTML text nodes. To add custom styles, attributes, or metadata to specific parts of text, use the [Span Attributes](https://comark.dev/syntax/attributes#span-attributes) syntax: `Hello [world]{data-world="earth" style="color: blue"}`.   
   
 This creates a `<span>` element with custom attributes, allowing you to style or add metadata to inline text.
</callout>

## Lists

### Unordered

```mdc
- Item 1
- Item 2
  - Nested item
  - Another nested item
- Item 3
```

### Ordered

```mdc
1. First item
2. Second item
   1. Nested item
   2. Another nested item
3. Third item
```

## Links

<code-preview>
[Link text](https://example.com)
[Link with title](https://example.com){title="Link title"}



#code
```mdc
[Link text](https://example.com)
[Link with title](https://example.com "Link title")
```
</code-preview>

<callout icon="i-lucide-info">
Add custom attributes to links with the [Attributes](https://comark.dev/syntax/attributes) syntax: `[Link](url){target="_blank"}`.
</callout>

Bare URLs like `https://example.com` are automatically converted into clickable links. Disable this with the [`linkify`](https://comark.dev/reference/parse#options) option (`{ linkify: false }`).

## Images

<code-preview>
![Image alt text](https://picsum.photos/seed/comark/1200/600)
![Image with title & no zoom](https://picsum.photos/seed/comark-title/1200/600 "Image title"){:zoom="false"}



#code
```mdc
![Image alt text](https://picsum.photos/seed/comark/1200/600)
![Image with title & no zoom](https://picsum.photos/seed/comark-title/1200/600 "Image title"){:zoom="false"}
```
</code-preview>

By default, images support interactive zoom: clicking an image opens it in a modal overlay with smooth transitions, allowing users to examine details more closely.

To prevent zoom on a specific image, add the `:zoom="false"` attribute.

<callout to="https://ui.nuxt.com/docs/typography/images-and-embeds">
Learn more about images and embeds in the Nuxt UI docs.
</callout>

## Blockquotes

<code-preview>
<div>
> This is a blockquote
>
> And contain other markdown elements like **bold** and *italic*
</div>

#code
```mdc
> This is a blockquote
>
> And contain other markdown elements like **bold** and *italic*
```
</code-preview>

### Alerts

The [alerts plugin](https://comark.dev/plugins/defaults/alert) is built-in and transforms special blockquotes into styled callout blocks. Place an alert marker on the first line of a blockquote:

```mdc
> [!NOTE]
> Useful information that users should know, even when skimming content.

> [!TIP]
> Helpful advice for doing things better or more easily.

> [!IMPORTANT]
> Key information users need to know to achieve their goal.

> [!WARNING]
> Urgent info that needs immediate user attention to avoid problems.

> [!CAUTION]
> Advises about risks or negative outcomes of certain actions.
```

Supported markers: `[!NOTE]`, `[!TIP]`, `[!IMPORTANT]`, `[!WARNING]`, `[!CAUTION]`.

### Horizontal Rules

Any of these create a horizontal rule:

```mdc
---
***
___
```

---

## Code Blocks

Comark provides advanced code block features with metadata support.

### Basic Code Block

<code-preview>
```javascript
function hello() {
  console.log("Hello, World!")
}
```



#code
~~~mdc
```javascript
function hello() {
  console.log("Hello, World!")
}
```
~~~
</code-preview>

### Filename Metadata

Add a filename using `[...]` brackets:

<code-preview>
```javascript [server.js]
const express = require('express')
const app = express()
```



#code
~~~mdc
```javascript [server.js]
const express = require('express')
const app = express()
```
~~~
</code-preview>

### Line Highlighting

Highlight specific lines using `{...}` syntax:

<code-preview>
```javascript {1-3,5}
function example() {
  const a = 1
  const b = 2
  const c = 3
  return a + b + c
}
```



#code
~~~mdc
```javascript {1-3,5}
function example() {
  const a = 1
  const b = 2
  const c = 3
  return a + b + c
}
```
~~~
</code-preview>

| Syntax          | Description               |
| --------------- | ------------------------- |
| `{3}`           | Single line               |
| `{1-5}`         | Range of lines            |
| `{1,3,5}`       | Multiple specific lines   |
| `{1-3,7,10-12}` | Combined ranges and lines |

### Combined Metadata

All metadata can be combined in any order:

<code-preview>
```javascript [utils.ts] {1-3}
function hello() {
  console.log("Hello")
}
```



#code
~~~mdc
```javascript {1-3} [utils.ts] meta=value
function hello() {
  console.log("Hello")
}
```
~~~
</code-preview>

### Special Characters in Filename

Use backslash to escape special characters:

<code-preview>
```typescript [@[...slug\\\].ts]
// Brackets and special chars are supported
```



#code
~~~mdc
```typescript [@[...slug\].ts]
// Brackets and special chars are supported
```
~~~
</code-preview>

### AST Structure

Code blocks produce this AST structure:

```json
[
  "pre",
  {
    "language": "javascript",
    "filename": "server.js",
    "highlights": [1, 2, 3],
    "meta": "meta=value"
  },
  ["code", { "class": "language-javascript" }, "code content here"]
]
```

---

## Task Lists

Comark supports GitHub Flavored Markdown task lists:

<code-preview>
- [x] Completed task
- [ ] Pending task
- [ ] - [ ] Nested pending task
  - [x] Nested completed task



#code
```mdc
- [x] Completed task
- [ ] Pending task
- [x] Another completed task
  - [ ] Nested pending task
  - [x] Nested completed task
```
</code-preview>

- `[x]` or `[X]` for completed tasks
- `[ ]` for pending tasks
- Works in both ordered and unordered lists
- Supports nesting

---

## Tables

<code-preview>
| Header 1 | Header 2 | Header 3 |
| -------- | -------- | -------- |
| Cell 1   | Cell 2   | Cell 3   |
| Cell 4   | Cell 5   | Cell 6   |



#code
```mdc
| Header 1 | Header 2 | Header 3 |
| -------- | -------- | -------- |
| Cell 1   | Cell 2   | Cell 3   |
| Cell 4   | Cell 5   | Cell 6   |
```
</code-preview>

### Aligned Tables

<code-preview>
| Left Aligned | Center Aligned | Right Aligned |
| :----------- | :------------: | ------------: |
| Left         | Center         | Right         |
| Text         | Text           | Text          |



#code
```mdc
| Left Aligned | Center Aligned | Right Aligned |
| :----------- | :------------: | ------------: |
| Left         | Center         | Right         |
| Text         | Text           | Text          |
```
</code-preview>

| Syntax  | Alignment |
| ------- | --------- |
| `:---`  | Left      |
| `:---:` | Center    |
| `---:`  | Right     |

### Inline Markdown in Tables

<code-preview>
| Feature  | Status     | Link                                   |
| -------- | ---------- | -------------------------------------- |
| **Bold** | *Italic*   | [Link](https://example)                |
| `Code`   | ~~Strike~~ | ![Image](https://picsum.photos/120/30) |



#code
```mdc
| Feature      | Status          | Link                    |
| ------------ | --------------- | ----------------------- |
| **Bold**     | *Italic*        | [Link](https://example) |
| `Code`       | ~~Strike~~      | ![Image](https://picsum.photos/120/30)       |
```
</code-preview>

## Comments

HTML-style comments are supported and preserved in the AST but not rendered in output:

```mdc
<!-- This is a comment -->
```

Comments can span multiple lines:

```mdc
<!--
This is a multi-line comment
that can contain any text
-->
```

Comments are represented in the [document model](https://comark.dev/getting-started/document-model#comment-nodes) as a tuple with `null` as the tag:

```json
[null, {}, " comment text "]
```

## Emojis

Comark includes built-in emoji support using the `:emoji_name:` syntax:

<code-preview>
Hello 👋 Welcome to our docs! 🚀



#code
```mdc
Hello :wave: Welcome to our docs! :rocket:
```
</code-preview>

### Popular Emojis

<code-preview>
😄 ❤️ 🔥 🚀 ✨ 🎉 🤔 👀 💯 ⭐ ⚡ 💡 ⚠️



#code
```mdc
:smile: :heart: :fire: :rocket: :sparkles: :tada:
:thinking: :eyes: :100: :star: :zap: :bulb: :warning:
```
</code-preview>


## Sitemap

See the full [sitemap](https://docs-template.comark.dev/sitemap.md) for all pages.
