home / skills / openclaw / skills / notion-md

notion-md skill

/skills/maweis1981/notion-md

This skill converts Markdown to Notion blocks with full format support, empowering you to create rich pages from files or input.

npx playbooks add skill openclaw/skills --skill notion-md

Review the files below or copy the command above to add this skill to your agents.

Files (7)
SKILL.md
3.0 KB
---
name: notion-md
description: Convert Markdown to Notion blocks with full format support. Handles bold, italic, strikethrough, inline code, headings, lists, tables, callouts, and more.
homepage: https://developers.notion.com/reference/block
metadata:
  openclaw:
    emoji: "📝"
    requires:
      env: ["NOTION_API_KEY"]
    primaryEnv: "NOTION_API_KEY"
---

# notion-md

Convert Markdown to Notion blocks with full format support.

## Features

- **Rich Text**: Bold, italic, strikethrough, inline code, underline, color
- **Headings**: H1, H2, H3 with proper styling
- **Lists**: Bulleted, numbered, toggle lists
- **Blocks**: Quotes, callouts, dividers, code blocks
- **Advanced**: Tables, nested content, links
- **Parent Page**: Configurable parent page ID

## Setup

### 1. Get Notion API Key

1. Go to https://www.notion.so/my-integrations
2. Create new integration
3. Copy the API key (starts with `ntn_`)

### 2. Configure API Key

```bash
# Option A: Environment variable
export NOTION_API_KEY="ntn_your_key"

# Option B: Config file
mkdir -p ~/.config/notion
echo "ntn_your_key" > ~/.config/notion/api_key
```

### 3. Get Parent Page ID

The parent page where new pages will be created:

```bash
notion-md list-pages
```

Or set default:

```bash
export NOTION_PARENT_PAGE_ID="parent_page_id"
```

## Usage

### Create Page from File

```bash
notion-md create --file article.md --title "My Article" --emoji 📝
```

### Create from stdin

```bash
echo "# Hello World" | notion-md create "Page Title"
```

### Options

| Option | Description |
|--------|-------------|
| `--file, -f` | Input Markdown file |
| `--title, -t` | Page title (required) |
| `--emoji, -e` | Page icon (default: 📄) |
| `--parent-id, -p` | Parent page ID |
| `--dry-run` | Preview without creating |

### List Pages

```bash
notion-md list-pages
```

### Append to Page

```bash
echo "## New Section" | notion-md append --page-id "abc123..."
```

## Notion Format Mapping

| Markdown | Notion Block |
|----------|--------------|
| `# Title` | heading_1 |
| `## Title` | heading_2 |
| `### Title` | heading_3 |
| `**bold**` | bold annotation |
| `*italic*` | italic annotation |
| `~~text~~` | strikethrough |
| `` `code` `` | code annotation |
| `---` | divider |
| `- item` | bulleted_list_item |
| `1. item` | numbered_list_item |
| `> quote` | quote |
| ````text```` | code block |
| `::: callout` | callout |
| `\| table \|` | table (basic) |

## Examples

### Rich Content

```markdown
# My Article

**This is bold** and *this is italic*.

> Important quote here

## Code Example

```python
def hello():
    print("Hello World")
```

- Item 1
- Item 2
```

### Create with Options

```bash
notion-md create \
  --file blog-post.md \
  --title "My Blog Post" \
  --emoji ✍️ \
  --parent-id "page_id_here"
```

## Environment Variables

| Variable | Description |
|----------|-------------|
| `NOTION_API_KEY` | Notion API key |
| `NOTION_PARENT_PAGE_ID` | Default parent page ID |

## API Version

Notion API: 2022-06-28

Overview

This skill converts Markdown documents into Notion block structures with full formatting support. It preserves headings, lists, tables, callouts, code blocks, and text annotations so content appears in Notion as intended. It supports creating new pages, appending to existing pages, and dry-run previews.

How this skill works

The tool parses Markdown input (file or stdin) and maps Markdown elements to Notion block types and rich text annotations. It authenticates with the Notion API using an integration key and can create pages under a configurable parent page ID or append content to an existing page. A dry-run option shows the resulting Notion blocks without making API calls.

When to use it

  • Migrating Markdown-based articles, docs, or notes into Notion
  • Automating publication of blog posts or docs from a CI/CD pipeline
  • Backing up Markdown content into a Notion workspace
  • Appending structured sections to an existing Notion page
  • Previewing how Markdown will render in Notion before upload

Best practices

  • Store the NOTION_API_KEY securely as an environment variable or config file
  • Set NOTION_PARENT_PAGE_ID to control where pages are created
  • Use the --dry-run option to validate block mapping before creating pages
  • Keep large code blocks and tables formatted in Markdown to ensure accurate conversion
  • Test with a sample file to confirm styling (colors, callouts) maps as expected

Example use cases

  • Create a new Notion page from a local article.md with title and emoji
  • Pipe README.md into the tool to append a documentation section to a knowledge base page
  • Automate daily notes creation from a Markdown template via a cron job
  • Convert a Markdown export of a wiki into Notion pages for archival
  • Preview Notion blocks for a draft using the dry-run mode before pushing updates

FAQ

What Markdown features are supported?

Headings (H1-H3), bold, italic, strikethrough, underline, inline code, code blocks, bulleted/numbered/toggle lists, quotes, dividers, callouts, and basic tables are supported.

How do I authenticate with Notion?

Provide a Notion integration key via the NOTION_API_KEY environment variable or a config file (~/.config/notion/api_key).