MarkDown TurnDown icon

MarkDown TurnDown

Node to use in n8n that allows you to convert HTML to MarkDown using one of the most famous JS libraries that perform this conversion to Turndown | PT-BR: Nó para usar em n8n que permite converter HTML para MarkDown usando uma das bibliotecas JS mais famosas que realizam essa conversão, Turndown

Overview

This node provides conversion between Markdown and HTML formats. It supports two operations: converting HTML content into Markdown syntax, and converting Markdown text into HTML markup. This is useful in scenarios where you need to transform content for different platforms or editors that require either Markdown or HTML input/output.

Practical examples include:

  • Converting HTML email templates into Markdown for easier editing or version control.
  • Transforming Markdown documentation into HTML for web display.
  • Processing user-generated content that may be submitted in one format but needs to be stored or displayed in another.

Properties

Name Meaning
Input The string content to be transformed. This can be either Markdown or HTML depending on the operation selected.
Output Key The key name under which the converted output will be stored in the node's JSON output object. Default is "data".

Output

The node outputs an array of items, each containing a json object. Within this object, the converted content is stored under the key specified by the "Output Key" property (default "data"). The value is a string representing the converted content:

  • For HTML > Markdown operation: the output string is Markdown syntax derived from the input HTML.
  • For Markdown > HTML operation: the output string is HTML markup generated from the input Markdown.

No binary data output is produced by this node.

Dependencies

  • Uses the external library turndown to convert HTML to Markdown.
  • Uses the external library marked to convert Markdown to HTML.

No special API keys or credentials are required. The node runs entirely within n8n using these bundled JavaScript libraries.

Troubleshooting

  • Unknown Operation Error: If an unsupported operation is selected, the node throws an error indicating the operation is not known. Ensure the operation property is set to either "HTML > Markdown" or "Markdown > HTML".
  • Invalid Input Format: Providing malformed HTML or Markdown may result in unexpected output or errors. Validate input content before processing.
  • Empty Output: If the input string is empty, the output will also be empty. Confirm that the input property contains valid content.

If the node is configured to continue on failure, errors for individual items will be included in the output with an error field describing the issue.

Links and References

Discussion