Notion To Markdown icon

Notion To Markdown

Node to transform markdown and notion blocks

Overview

This node transforms content between Markdown format and Notion blocks, supporting three operations: converting Markdown to Notion blocks, Notion blocks to Markdown, and transforming Notion blocks into a different Notion block structure. It is useful for users who want to integrate or migrate content between Markdown-based systems and Notion, enabling seamless content interchange.

Practical examples:

  • Importing Markdown notes into Notion by converting them into Notion's block format.
  • Exporting Notion pages as Markdown text for use in other editors or version control.
  • Reformatting or processing Notion blocks internally without changing the format.

Properties

Name Meaning
Operation Choose the conversion operation: "Markdown to Notion", "Notion to Markdown", or "Notion to Notion".
Input Markdown The Markdown text to be converted into Notion blocks (used only when Operation is "Markdown to Notion").
Input Notion Blocks The Notion blocks JSON string to be converted or transformed (used when Operation is "Notion to Markdown" or "Notion to Notion").
Output Key The key name under which the output result will be stored in the node's JSON output.
Convert Images to Base64 Whether to convert images in Notion blocks to base64 encoding to avoid URL expiration (only applies when Operation is "Notion to Markdown").

Output

The node outputs a JSON object with a single key defined by the user (default is "output"). The value depends on the selected operation:

  • For Markdown to Notion, the output is an array of Notion block objects representing the input Markdown content.
  • For Notion to Markdown, the output is a Markdown string generated from the input Notion blocks. If enabled, images are embedded as base64 strings to prevent link expiration.
  • For Notion to Notion, the output is a transformed array of Notion blocks, potentially reformatted or filtered.

No binary data output is produced by this node.

Dependencies

  • Uses the external library @tryfabric/martian for converting Markdown to Notion blocks.
  • Uses internal helper modules for converting Notion blocks to Markdown and for Notion-to-Notion transformations.
  • Requires no special API keys or credentials.
  • No additional n8n environment configuration is necessary beyond standard node setup.

Troubleshooting

  • Common issues:

    • Invalid or malformed Markdown or Notion blocks input may cause errors during conversion.
    • Large inputs might lead to performance delays.
    • Forgetting to set the correct operation or input property can result in empty or incorrect outputs.
  • Error messages:

    • Errors during processing include the item index and error message, e.g., "Error processing item 0: [message]".
    • To resolve, verify that the input Markdown or Notion blocks are correctly formatted JSON strings or valid Markdown.
    • Enable "Continue On Fail" in the node settings to allow partial processing if some items fail.

Links and References

Discussion