Notion To Markdown icon

Notion To Markdown

Node to transform markdown and notion blocks

Overview

This node transforms content between Notion blocks and Markdown formats. It supports three operations:

  • Markdown to Notion: Converts Markdown text into Notion block structures.
  • Notion to Markdown: Converts Notion blocks into Markdown text, with an option to convert images to base64 encoding.
  • Notion to Notion: Transforms Notion blocks into a different Notion block format (likely for normalization or restructuring).

This node is useful when integrating Notion content with other systems that use Markdown or when manipulating Notion data programmatically. For example, you can export Notion pages as Markdown for static site generators or convert Markdown notes into Notion pages.

Properties

Name Meaning
Input Notion Blocks The Notion blocks JSON string to be transformed (used in "Notion to Markdown" and "Notion to Notion" operations).
Output Key The key under which the output result will be stored in the item’s JSON object.
Operation The transformation operation to perform: "Markdown to Notion", "Notion to Markdown", or "Notion to Notion".
Input Markdown The Markdown text to be converted to Notion blocks (used only in "Markdown to Notion" operation).
Convert Images to Base64 Whether to convert images in Notion blocks to base64 strings to avoid URL expiration (only applies to "Notion to Markdown").

Output

The node outputs the transformed content under the specified output key in each item's JSON data:

  • For Markdown to Notion, the output is an array of Notion block objects representing the input Markdown.
  • For Notion to Markdown, the output is a Markdown string generated from the input Notion blocks. If enabled, images are embedded as base64 strings.
  • For Notion to Notion, the output is a transformed array of Notion blocks.

No binary data output is produced by this node.

Dependencies

  • Uses the external library @tryfabric/martian for converting Markdown to Notion blocks.
  • Uses local modules blocks-to-markdown and blocks-to-blocks for converting Notion blocks to Markdown and transforming Notion blocks respectively.
  • No external API keys or credentials are required.

Troubleshooting

  • Invalid input format: Ensure that the input Notion blocks are valid JSON strings and Markdown input is properly formatted.
  • Image conversion issues: When converting images to base64, large images may cause performance issues or memory exhaustion.
  • Operation mismatch: Selecting an operation but providing input for another (e.g., choosing "Markdown to Notion" but providing Notion blocks) will lead to errors.
  • Error messages typically include the item index and error description. Check the input data format and property values if errors occur.

Links and References

Discussion