Overview
This node, named "Notion MD," provides bidirectional transformation between Markdown text and Notion blocks. It supports two main operations:
- Markdown to Notion: Converts a Markdown string into an array of Notion block objects. This is useful when you want to programmatically create or update content in Notion by starting from Markdown-formatted text.
- Notion to Markdown: Converts an array of Notion block objects back into Markdown text. This helps extract or export Notion content into Markdown format for use in other tools or workflows.
Typical scenarios include:
- Importing Markdown notes or documentation into Notion with proper block structure.
- Exporting Notion pages or content as Markdown for version control, publishing, or editing outside Notion.
Example:
- Inputting a Markdown string with headings, lists, and images to get corresponding Notion blocks.
- Taking Notion page content represented as JSON blocks and converting it to Markdown for blog posts or static site generators.
Properties
| Name | Meaning |
|---|---|
| Input | The input data to be transformed. For "Markdown to Notion" operation, this is a Markdown string. For "Notion to Markdown", this is a JSON array of Notion blocks. |
| Output Key | The key name under which the transformed output will be stored in the node's JSON output object. Default is "output". |
Output
The node outputs the transformed data under the specified output key in each item's JSON object:
- For Markdown to Notion, the output is an array of Notion block objects representing the parsed Markdown content. These blocks follow Notion's block schema (e.g., paragraphs, headings, lists, images).
- For Notion to Markdown, the output is a Markdown string reconstructed from the provided Notion blocks. It includes support for headings, paragraphs, lists, tables, quotes, code blocks, images, videos, and dividers.
No binary data output is produced by this node.
Dependencies
- Uses the external library
@tryfabric/martianfor converting Markdown to Notion blocks. - Relies on internal helper functions for converting Notion blocks back to Markdown.
- No external API keys or credentials are required.
- Requires standard n8n environment with access to the bundled dependencies.
Troubleshooting
- Unknown Operation Error: If an unsupported operation value is provided, the node throws an error indicating the operation is not known. Ensure the operation property is set to either
"markdownToNotion"or"notionToMarkdown". - Invalid Input Format: Providing malformed Markdown or improperly structured Notion blocks may cause conversion errors or incomplete output. Validate input formats before running the node.
- Unresolved Children Blocks Warning: When converting Notion blocks to Markdown, blocks that have unresolved children are skipped with a warning comment in the output. This indicates nested blocks were not processed and may require flattening or additional handling.
- HTML Tags in Output: By default, some annotations like underline or color are converted to HTML tags in Markdown output. There is an option to disable HTML output, but if not set, users might see HTML spans or underline tags in the Markdown.
Links and References
- Notion API Documentation
- Markdown Syntax Guide
- Martian Library GitHub - Used for Markdown to Notion conversion
This summary is based solely on static analysis of the provided source code and property definitions.
