Skip to content
Last updated

Redocly projects support enhanced Markdown that combines standard Markdown syntax with powerful Markdoc extensions, giving you rich formatting options and interactive components for your documentation.

Standard Markdown

All standard Markdown syntax works in Redocly projects:

Text formatting

**Bold text** and *italic text*

~~Strikethrough text~~

`Inline code`

> Blockquotes for callouts and emphasis

Headings and structure

# Page title (H1)
## Section heading (H2)  
### Subsection heading (H3)

- Bulleted lists
- With multiple items

1. Numbered lists
2. In sequential order
[Link text](./relative-page.md)
[External link](https://example.com)

![Image alt text](./images/screenshot.png)

Code blocks

```javascript
// Syntax highlighting for many languages
function example() {
  return "Hello world";
}
```

Redocly enhancements

Redocly extends standard Markdown with additional capabilities:

Front matter configuration

Control page behavior with YAML front matter:

---
title: Custom page title
description: Page description for SEO
---

Enhanced code blocks

Add titles, line highlighting, and annotations:

```javascript {% title="app.js" highlight="{2,4-6}" %}
function processData() {
  const data = fetchData(); 
  
  if (!data) { // // [!code error]
    throw new Error('No data'); // // [!code error]
  } // // [!code error]
  
  return data.map(item => ({ // // [!code ++]
    id: item.id, // // [!code ++]
    name: item.name // // [!code ++]
  })); // // [!code ++]
}
```

Learn more about code snippet configuration for all highlighting and annotation options, and explore Markdoc code tags for multi-language examples.

File trees

Display project structure with the treeview format:

```treeview
project/
├── docs/
│   ├── api/
│   │   └── openapi.yaml
│   └── guides/
│       └── getting-started.md
├── images/
└── redocly.yaml
```

Diagrams

Add visual diagrams using Mermaid syntax:

```mermaid
graph TD
    A[User Request] --> B{Authentication}
    B -->|Valid| C[Process Request]
    B -->|Invalid| D[Return Error]
    C --> E[Return Response]
```

Learn more about adding diagrams with additional examples and chart types.

Markdoc tags

Redocly includes powerful Markdoc tags for interactive elements:

Content organization

{% tabs %}
{% tab label="Option A" %}
Content for the first tab.
{% /tab %}
{% tab label="Option B" %}
Content for the second tab.
{% /tab %}
{% /tabs %}

Learn more about the tabs tag for organizing content.

Visual elements

{% admonition type="info" name="Important note" %}
This is an informational callout with custom styling.
{% /admonition %}

{% cards %}
{% card title="Feature 1" icon="star" to="./feature-1.md" %}
Description of the first feature.
{% /card %}
{% card title="Feature 2" icon="gear" to="./feature-2.md" %}
Description of the second feature.
{% /card %}
{% /cards %}

Learn more about admonitions and cards for enhanced visual presentation.

Images and icons

Enhanced image display with sizing, lightbox, and captions:

{% img src="./images/screenshot.png" alt="Application screenshot" width="400" lightbox=true %}
A screenshot showing the main application interface.
{% /img %}

Add inline icons for visual enhancement:

{% icon name="star" /%} Highlighted feature
{% icon name="warning" color="orange" /%} Important note

Learn more about image handling and icons for visual elements.

Code and examples

{% code-snippet file="./examples/sample.js" title="Sample code" /%}

{% markdoc-example %}
This shows how Markdoc syntax renders in practice.
{% /markdoc-example %}
{% code-group %}
{% code title="JavaScript" lang="javascript" %}
fetch('/api/users')
  .then(response => response.json())
  .then(data => console.log(data));
{% /code %}
{% code title="Python" lang="python" %}
import requests
response = requests.get('/api/users')
data = response.json()
print(data)
{% /code %}
{% /code-group %}

Learn more about code snippets, code groups, and Markdoc examples for displaying code.

Content reuse

{% partial file="/_partials/shared-section.md" /%}

Learn more about partials for reusing content across pages.

API documentation

{% openapi-code-sample 
   path="/users" 
   method="post" 
   lang="javascript" /%}

{% json-schema schema="user-schema.json" /%}

Learn more about OpenAPI code samples and JSON schema for API documentation.

Tables

Redocly uses enhanced table formatting:

{% table %}
- Column 1
- Column 2  
- Column 3
---
- Row 1, Cell 1
- Row 1, Cell 2
- Row 1, Cell 3
---
- Row 2, Cell 1
- Row 2, Cell 2
- Row 2, Cell 3
{% /table %}

Learn more about table formatting for structured data presentation.

Best practices

File organization

  • Use descriptive filenames with kebab-case: user-authentication.md
  • Organize related content in folders
  • Place reusable content in _partials/ folders

Writing style

  • Start with a clear H1 heading
  • Use descriptive link text instead of "click here"
  • Include alt text for images
  • Break up long content with headings and lists

Cross-references

  • Use relative links for internal pages: ./other-page.md
  • Link to specific sections with anchors: ./page.md#section-name
  • Test links to ensure they work correctly

Images and assets

  • Store images in organized folders like ./images/
  • Use descriptive filenames for images
  • Optimize image sizes for web display
  • Consider using static assets for predictable URLs

Resources

  • Markdoc tags reference - Complete library of interactive components like cards, tabs, admonitions, and code groups for enhanced content
  • Content reuse with partials - Share and reuse content across multiple pages to maintain consistency and reduce duplication
  • Project structure guide - Organize your content files and directories for optimal navigation and maintenance
  • Links and navigation - Create internal and external links with automatic validation and cross-references between pages and sections
  • Static assets management - Host images, files, and other static resources with predictable URLs and optimization
  • Markdown configuration - Customize Markdown processing, syntax highlighting, and rendering behavior