| allowed-tools | description | argument-hint |
|---|---|---|
Read, Write, mcp__Notion__search, mcp__Notion__fetch, mcp__Notion__notion-get-comments |
Import Notion pages to markdown with optional content transformation |
<notion-url-or-id> [output-path] [--rewrite] [--lang <code>] [--template <path>] |
CRITICAL: By default, you perform a DIRECT, FAITHFUL import - preserving the original content structure and text exactly as it appears in Notion. Only transform content when explicitly requested with the --rewrite flag.
IMPORTANT: Always fetch and process the LATEST content from Notion, regardless of whether the file already exists. The entire content should be updated, not just the metadata headers.
This command helps developers: - Import documentation from Notion to local markdown files - Update existing markdown files with the latest Notion content - Transform product-oriented content to technical documentation - Translate content to different languages - Apply custom templates for consistent formatting<input_parsing> Input: "$ARGUMENTS"
/notion-to-md <notion-url-or-id> [output-path] [options]
Arguments:
notion-url-or-id Required. Notion page URL or ID to import
output-path Optional. Where to save the markdown file
(if not provided, will ask interactively)
Options:
--rewrite Transform content for technical audience
--lang <code> Translate to specified language (en, ja, es, fr, etc.)
--template <path> Apply custom markdown template
--help Show this help message
Examples:
/notion-to-md https://notion.so/page-id
/notion-to-md page-id ./docs/imported.md
/notion-to-md page-id --rewrite --lang ja
/notion-to-md page-id ./output.md --template ./template.md --rewrite
Parse arguments:
- Check for --help flag first
- First argument: Notion page URL or ID (required)
- Second argument (if not a flag): Output path
- Remaining arguments: Parse flags and their values </input_parsing>
If no arguments provided or --help flag present:
- Display the usage information above
- Exit without further processing
- Notion page identifier (URL or ID)
- Output path (if provided)
- Flags: --rewrite, --lang, --template
Use mcp__Notion__fetch with the page ID to retrieve:
- Page title
- Full content in Notion's enhanced markdown format
- Any embedded databases or sub-pages
- Comments if relevant
If no output path provided:
- Ask user: "Where would you like to save this file?"
- Suggest:
./{sanitized-page-title}.md - Accept user input for custom path
If the output file already exists:
- Notify user: "π Updating existing file: {file_path}"
- The file will be COMPLETELY REPLACED with the latest Notion content
- Previous content will be overwritten (not merged)
IMPORTANT: Always process the FULL content fetched from Notion, not just update headers
-
Convert Notion-flavored markdown to standard markdown:
- Convert Notion mentions to plain text
- Handle toggles and callouts appropriately
- Preserve code blocks and formatting
- Convert database views to tables when possible
- Handle embedded content gracefully
-
Clean up formatting:
- Ensure consistent heading levels
- Fix list formatting
- Normalize line breaks
- Preserve important metadata
-
Analyze content structure and purpose
-
Identify key information:
- Core concepts and requirements
- Technical details
- Action items and decisions
- Dependencies and constraints
-
Reorganize for technical audience:
- Add technical context sections
- Convert business language to technical terms
- Structure as specification or technical guide
- Add implementation considerations
- Include technical prerequisites
- Add code examples where helpful
-
Language Translation (if --lang specified):
- Translate content to target language
- Maintain technical terminology standards
- Adapt cultural references appropriately
- Preserve code blocks in English
-
Template Application (if --template specified):
- Read template structure
- Map Notion content to template sections
- Fill in template placeholders
- Maintain template's formatting style
---
source: notion
source_url: {original_url}
imported_date: {current_date}
lang: {language_code}
transform: {direct|rewrite}
---
# {Page Title}- Preserve or improve heading hierarchy
- Maintain logical flow
- Include any important metadata
- Add TOC for long documents
- ALWAYS use Write tool to save the file (not Edit or MultiEdit)
- Write the COMPLETE processed content to specified path
- This REPLACES any existing content entirely
- Confirm successful save
- Show summary of what was done including update status
<output_format> After successful import:
β
Successfully imported Notion page to markdown
Source: {notion_url}
Output: {file_path}
Status: {Created|Updated}
Mode: {direct|rewrite}
Language: {language}
Template: {template_name|none}
Summary:
- {X} sections processed
- {Y} code blocks preserved
- {Z} images/assets referenced
- File size: {size}
The markdown file has been saved to: {full_path}
</output_format>
<error_handling> Common issues:
- Page not found: Verify URL/ID is correct and you have access
- Permission denied: Ensure Notion integration has access to the page
- Invalid output path: Check directory exists and have write permissions
- Template not found: Verify template path is correct
- Network timeout: Retry with the same command </error_handling>
<human_review_needed> Flag for manual review when:
- Complex embedded content that may not convert well
- Ambiguous technical translations
- Template mapping uncertainty
- Loss of important formatting or structure </human_review_needed>
/notion-to-md abc123 ./docs/technical-spec.md --rewriteβ Transforms product spec to technical documentation
/notion-to-md abc123 --rewrite --lang ja --template ./templates/rfc.mdβ Creates Japanese RFC document from Notion content
If user mentions multiple pages, suggest:
# Create a script for multiple imports
for page_id in page1 page2 page3; do
/notion-to-md $page_id ./docs/$page_id.md --rewrite
done