
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
Actions2
Overview
This node provides bidirectional conversion between Markdown and HTML formats. It supports two main operations:
- HTML to Markdown: Converts HTML input into Markdown syntax using the Turndown library, optionally enhanced with GitHub Flavored Markdown (GFM) support.
- Markdown to HTML: Converts Markdown input into HTML using the Marked library.
This node is useful in scenarios where you need to transform content between these two popular markup languages, such as preparing content for different publishing platforms, email templates, or documentation systems.
Practical examples:
- Converting rich HTML content from a CMS into Markdown for use in static site generators.
- Transforming Markdown notes into HTML emails or web pages.
- Normalizing user input by converting HTML pasted into a form into Markdown for storage.
Properties
Name | Meaning |
---|---|
Input | The string input to be transformed. This can be either Markdown or HTML depending on operation. |
Output Key | The key name under which the converted output will be stored in the JSON output object. |
Use GFM Plugin | Boolean flag indicating whether to apply GitHub Flavored Markdown extensions when converting HTML to Markdown. |
Output
The node outputs an array of items, each containing a json
object. The converted content is stored under the key specified by the "Output Key" property (default "data"
).
- For HTML to Markdown, the output is a Markdown string.
- For Markdown to HTML, the output is an HTML string.
No binary data is produced by this node.
Example output JSON snippet:
{
"data": "# Converted Markdown or <p>Converted HTML</p>"
}
Dependencies
- Uses the Turndown library for HTML to Markdown conversion.
- Optionally uses the joplin-turndown-plugin-gfm plugin to support GitHub Flavored Markdown features.
- Uses the Marked library for Markdown to HTML conversion.
No external API keys or services are required. All processing is done locally within the node.
Troubleshooting
- Unknown Operation Error: If an unsupported operation value is provided, the node throws an error stating the operation is not known. Ensure the operation is either
"htmlToMarkdown"
or"markdownToHtml"
. - Empty or Invalid Input: Providing empty or malformed HTML/Markdown strings may result in empty or unexpected output. Validate input before passing it to the node.
- Plugin Usage: Enabling the GFM plugin only affects the HTML to Markdown conversion. It has no effect on Markdown to HTML operation.
- Error Handling: If the node is set to continue on failure, errors during conversion will be attached to the output item with an
error
field; otherwise, execution stops on the first error.