Notion Markdown icon

Notion Markdown

Node to transform markdown and notion blocks

Overview

This node, named "Notion Markdown," is designed to transform content between Notion blocks and Markdown formats. It supports three main operations:

  • Markdown to Notion: Converts Markdown text into Notion block structures.
  • Notion to Markdown: Converts Notion blocks into Markdown text.
  • Notion to Notion: Transforms Notion blocks into a different Notion block format (likely for normalization or restructuring).

This node is useful in scenarios where users want to integrate Notion content with other systems that use Markdown or need to manipulate Notion blocks programmatically. For example, it can be used to export Notion pages as Markdown files or import Markdown content into Notion.

Properties

Name Meaning
Operation Choose the transformation operation: Markdown to Notion, Notion to Markdown, or Notion to Notion.
Input Markdown The Markdown text to convert into Notion blocks. (Shown only if operation is Markdown to Notion)
Input Notion Blocks The Notion blocks (in JSON string form) to convert either to Markdown or to another Notion block format.
Output Key The key name under which the output result will be stored in the node's JSON output object.
Convert Images to Base64 Whether to convert images within Notion blocks to base64 encoding to avoid expiration of Notion URLs. (Only for Notion to Markdown operation)

Output

The node outputs data in the JSON field under the user-defined output key (default "output"). The structure depends on the operation:

  • For Markdown to Notion, the output is an array of Notion block objects representing the converted Markdown content.
  • For Notion to Markdown, the output is a Markdown string generated from the input Notion blocks. If image conversion is 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.
  • Requires no special API keys or credentials.
  • No environment variables or additional n8n configurations are necessary beyond standard node setup.

Troubleshooting

  • Common issues:

    • Invalid JSON input for Notion blocks may cause parsing errors.
    • Large inputs might lead to performance delays.
    • Enabling image base64 conversion increases processing time and memory usage.
  • Error messages:

    • Errors during processing items will include the item index and error message.
    • Typical errors relate to malformed input data or unsupported block types.
  • Resolution tips:

    • Ensure Notion blocks input is valid JSON string.
    • Validate Markdown syntax before conversion.
    • Disable image base64 conversion if not needed to improve speed.
    • Use "Continue On Fail" option to handle errors gracefully when processing multiple items.

Links and References

Discussion