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 converts between HTML and Markdown formats. It supports two operations: converting HTML to Markdown and converting Markdown to HTML. This is useful for workflows that need to transform content markup, such as preparing HTML content for Markdown-based editors or rendering Markdown content as HTML for web display.

Practical examples:

  • Converting HTML email templates into Markdown format for documentation.
  • Transforming user-submitted Markdown content into HTML for website rendering.
  • Integrating with note-taking apps or CMS systems that require specific markup formats.

Properties

Name Meaning
Input The markup text to be transformed. Can be HTML or Markdown depending on the operation.
Output Key The key name under which the transformed output will be stored in the JSON output object.
Use GFM Plugin Whether to apply GitHub Flavored Markdown (GFM) plugin when converting HTML to Markdown.

Output

The node outputs a JSON object for each input item. The transformed content is stored under the key specified by the "Output Key" property (default is data). For example:

{
  "data": "<converted content here>"
}
  • When converting HTML to Markdown, the output is a Markdown string.
  • When converting Markdown to HTML, the output is an HTML string.

The node does not output binary data.

Dependencies

  • Uses the turndown library to convert HTML to Markdown.
  • Optionally uses the joplin-turndown-plugin-gfm plugin to support GitHub Flavored Markdown extensions.
  • Uses the marked library to convert Markdown to HTML.

No special external API keys or credentials are required. All processing is done locally within the node.

Troubleshooting

  • Unknown Operation Error: If an unsupported operation value is set, the node throws an error indicating the operation is unknown. Ensure the operation is either "HTML > Markdown" or "Markdown > HTML".
  • Invalid Input Format: Providing malformed HTML or Markdown may result in unexpected output or errors. Validate input before passing it to the node.
  • Plugin Usage: Enabling the GFM plugin only affects HTML to Markdown conversion. It has no effect on Markdown to HTML conversion.
  • Continue On Fail: If enabled, the node will continue processing subsequent items even if one fails, attaching error details to the output.

Links and References

Discussion