Pular para conteúdo

PARSE_MARKDOWN - Conversão de HTML para Markdown

O que é este Node?

O PARSE_MARKDOWN é o node responsável por converter conteúdo HTML em formato Markdown, preservando a formatação essencial como negrito, itálico, links, listas e estrutura de headings.

Por que este Node existe?

HTML é verboso e difícil de ler/editar diretamente, enquanto Markdown é limpo e intuitivo. O PARSE_MARKDOWN existe para:

  1. Legibilidade: Converter HTML em formato mais legível e editável
  2. Portabilidade: Markdown é universal e aceito em muitas plataformas (GitHub, Discord, Notion, etc)
  3. Simplicidade: Manter formatação importante sem complexidade do HTML
  4. Documentação: Facilitar criação de documentação a partir de conteúdo HTML

Como funciona internamente?

Quando o PARSE_MARKDOWN é executado, o sistema:

  1. Carrega o HTML: Lê o conteúdo HTML da variável especificada
  2. Limpa o HTML: Remove scripts, estilos e elementos desnecessários
  3. Converte para Markdown: Usa TurndownService para conversão inteligente
  4. Aplica regras personalizadas: Converte strikethrough (~~texto~~) e underline
  5. Normaliza formatação: Remove linhas vazias excessivas (se preserveFormatting = false)
  6. Armazena o resultado: Salva o Markdown na variável de saída

Código interno (html-parser-executor.service.ts:286-303):

private parseToMarkdown(html: string, config: HTMLParserNodeData): string {
  // Clean HTML first
  const $ = load(html);
  this.cleanHTML($, config);
  const cleanedHtml = $.html();

  // Convert to Markdown
  let markdown = this.turndownService.turndown(cleanedHtml);

  if (!config.preserveFormatting) {
    // Clean up excessive newlines
    markdown = markdown.replace(/\n{3,}/g, '\n\n');
    // Trim each line
    markdown = markdown.split('\n').map(line => line.trim()).join('\n');
  }

  return markdown.trim();
}

Quando você DEVE usar este Node?

Use PARSE_MARKDOWN sempre que precisar de converter HTML mantendo formatação básica:

Casos de uso

  1. Integração com plataformas: "Converter conteúdo HTML de blog para postar no GitHub"
  2. Criação de documentação: "Extrair conteúdo de páginas web para criar docs em Markdown"
  3. Notificações formatadas: "Converter emails HTML em mensagens Markdown para Slack/Discord"
  4. Edição de conteúdo: "Facilitar edição de conteúdo HTML convertendo para Markdown"

Quando NÃO usar PARSE_MARKDOWN

  • Não precisa de formatação: Use parse_text para texto puro sem formatação
  • Precisa de estrutura JSON: Use parse_structured para obter dados estruturados
  • Precisa de dados específicos: Use parse_custom com seletores CSS

Parâmetros Detalhados

inputVariable (string, obrigatório)

O que é: Nome da variável que contém o conteúdo HTML a ser convertido.

Padrão: "html_content"

Flow completo para testar:

{
  "name": "Teste HTML Parser - Parse Markdown Input",
  "nodes": [
    {
      "id": "start_1",
      "type": "start",
      "position": { "x": 100, "y": 100 },
      "data": { "label": "Início" }
    },
    {
      "id": "variable_1",
      "type": "variable",
      "position": { "x": 300, "y": 100 },
      "data": {
        "label": "HTML Source",
        "parameters": {
          "variableName": "meu_html",
          "variableValue": "<h1>Título</h1><p>Parágrafo com <strong>negrito</strong> e <em>itálico</em>.</p>"
        }
      }
    },
    {
      "id": "parser_1",
      "type": "html_parser",
      "position": { "x": 500, "y": 100 },
      "data": {
        "label": "Converter MD",
        "parameters": {
          "inputVariable": "meu_html",
          "parseMode": "markdown",
          "outputVariable": "markdown"
        }
      }
    },
    {
      "id": "message_1",
      "type": "message",
      "position": { "x": 700, "y": 100 },
      "data": {
        "label": "Mostrar",
        "parameters": {
          "message": "```\n{{markdown}}\n```"
        }
      }
    },
    {
      "id": "end_1",
      "type": "end",
      "position": { "x": 900, "y": 100 },
      "data": { "label": "Fim" }
    }
  ],
  "edges": [
    { "source": "start_1", "target": "variable_1" },
    { "source": "variable_1", "target": "parser_1" },
    { "source": "parser_1", "target": "message_1" },
    { "source": "message_1", "target": "end_1" }
  ]
}

Teste: Esperado: # Título\n\nParágrafo com **negrito** e *itálico*.

parseMode (string, obrigatório)

O que é: Modo de parsing do HTML. Para PARSE_MARKDOWN, deve ser "markdown".

Padrão: "text"

Flow completo para testar:

{
  "name": "Teste HTML Parser - Modo Markdown",
  "nodes": [
    {
      "id": "start_1",
      "type": "start",
      "position": { "x": 100, "y": 100 },
      "data": { "label": "Início" }
    },
    {
      "id": "variable_1",
      "type": "variable",
      "position": { "x": 300, "y": 100 },
      "data": {
        "label": "HTML com Links",
        "parameters": {
          "variableName": "html_links",
          "variableValue": "<p>Visite nosso <a href='https://example.com'>site</a> para mais informações.</p>"
        }
      }
    },
    {
      "id": "parser_1",
      "type": "html_parser",
      "position": { "x": 500, "y": 100 },
      "data": {
        "label": "Converter",
        "parameters": {
          "inputVariable": "html_links",
          "parseMode": "markdown",
          "outputVariable": "md_result"
        }
      }
    },
    {
      "id": "message_1",
      "type": "message",
      "position": { "x": 700, "y": 100 },
      "data": {
        "label": "Ver MD",
        "parameters": {
          "message": "{{md_result}}"
        }
      }
    },
    {
      "id": "end_1",
      "type": "end",
      "position": { "x": 900, "y": 100 },
      "data": { "label": "Fim" }
    }
  ],
  "edges": [
    { "source": "start_1", "target": "variable_1" },
    { "source": "variable_1", "target": "parser_1" },
    { "source": "parser_1", "target": "message_1" },
    { "source": "message_1", "target": "end_1" }
  ]
}

Teste: Esperado: Visite nosso [site](https://example.com) para mais informações.

outputVariable (string, opcional)

O que é: Nome da variável onde será armazenado o Markdown gerado.

Padrão: "parsed_content"

Flow completo para testar:

{
  "name": "Teste HTML Parser - Output Markdown",
  "nodes": [
    {
      "id": "start_1",
      "type": "start",
      "position": { "x": 100, "y": 100 },
      "data": { "label": "Início" }
    },
    {
      "id": "variable_1",
      "type": "variable",
      "position": { "x": 300, "y": 100 },
      "data": {
        "label": "HTML Lista",
        "parameters": {
          "variableName": "html_list",
          "variableValue": "<ul><li>Item 1</li><li>Item 2</li><li>Item 3</li></ul>"
        }
      }
    },
    {
      "id": "parser_1",
      "type": "html_parser",
      "position": { "x": 500, "y": 100 },
      "data": {
        "label": "Para Markdown",
        "parameters": {
          "inputVariable": "html_list",
          "parseMode": "markdown",
          "outputVariable": "lista_md"
        }
      }
    },
    {
      "id": "message_1",
      "type": "message",
      "position": { "x": 700, "y": 100 },
      "data": {
        "label": "Exibir",
        "parameters": {
          "message": "Lista em Markdown:\n{{lista_md}}"
        }
      }
    },
    {
      "id": "end_1",
      "type": "end",
      "position": { "x": 900, "y": 100 },
      "data": { "label": "Fim" }
    }
  ],
  "edges": [
    { "source": "start_1", "target": "variable_1" },
    { "source": "variable_1", "target": "parser_1" },
    { "source": "parser_1", "target": "message_1" },
    { "source": "message_1", "target": "end_1" }
  ]
}

Teste: Esperado: - Item 1\n- Item 2\n- Item 3

removeScripts (boolean, opcional)

O que é: Remove tags <script> e <noscript> antes da conversão.

Padrão: true

Flow completo para testar:

{
  "name": "Teste HTML Parser - Remove Scripts MD",
  "nodes": [
    {
      "id": "start_1",
      "type": "start",
      "position": { "x": 100, "y": 100 },
      "data": { "label": "Início" }
    },
    {
      "id": "variable_1",
      "type": "variable",
      "position": { "x": 300, "y": 100 },
      "data": {
        "label": "HTML com Script",
        "parameters": {
          "variableName": "html",
          "variableValue": "<div><h2>Título</h2><script>alert('test');</script><p>Conteúdo</p></div>"
        }
      }
    },
    {
      "id": "parser_1",
      "type": "html_parser",
      "position": { "x": 500, "y": 100 },
      "data": {
        "label": "Limpar e Converter",
        "parameters": {
          "inputVariable": "html",
          "parseMode": "markdown",
          "removeScripts": true,
          "outputVariable": "md"
        }
      }
    },
    {
      "id": "message_1",
      "type": "message",
      "position": { "x": 700, "y": 100 },
      "data": {
        "label": "Resultado",
        "parameters": {
          "message": "{{md}}"
        }
      }
    },
    {
      "id": "end_1",
      "type": "end",
      "position": { "x": 900, "y": 100 },
      "data": { "label": "Fim" }
    }
  ],
  "edges": [
    { "source": "start_1", "target": "variable_1" },
    { "source": "variable_1", "target": "parser_1" },
    { "source": "parser_1", "target": "message_1" },
    { "source": "message_1", "target": "end_1" }
  ]
}

Teste: Esperado: ## Título\n\nConteúdo (sem script)

removeStyles (boolean, opcional)

O que é: Remove tags <style> e atributos inline de estilo.

Padrão: true

Flow completo para testar:

{
  "name": "Teste HTML Parser - Remove Styles MD",
  "nodes": [
    {
      "id": "start_1",
      "type": "start",
      "position": { "x": 100, "y": 100 },
      "data": { "label": "Início" }
    },
    {
      "id": "variable_1",
      "type": "variable",
      "position": { "x": 300, "y": 100 },
      "data": {
        "label": "HTML Styled",
        "parameters": {
          "variableName": "styled_html",
          "variableValue": "<div style='color:blue'><strong style='font-size:20px'>Destaque</strong></div><style>.teste { margin: 10px; }</style>"
        }
      }
    },
    {
      "id": "parser_1",
      "type": "html_parser",
      "position": { "x": 500, "y": 100 },
      "data": {
        "label": "Converter Limpo",
        "parameters": {
          "inputVariable": "styled_html",
          "parseMode": "markdown",
          "removeStyles": true,
          "outputVariable": "clean_md"
        }
      }
    },
    {
      "id": "message_1",
      "type": "message",
      "position": { "x": 700, "y": 100 },
      "data": {
        "label": "Mostrar",
        "parameters": {
          "message": "{{clean_md}}"
        }
      }
    },
    {
      "id": "end_1",
      "type": "end",
      "position": { "x": 900, "y": 100 },
      "data": { "label": "Fim" }
    }
  ],
  "edges": [
    { "source": "start_1", "target": "variable_1" },
    { "source": "variable_1", "target": "parser_1" },
    { "source": "parser_1", "target": "message_1" },
    { "source": "message_1", "target": "end_1" }
  ]
}

Teste: Esperado: **Destaque** (sem styles)

preserveFormatting (boolean, opcional)

O que é: Preserva quebras de linha e espaçamento original do HTML.

Padrão: false

Flow completo para testar:

{
  "name": "Teste HTML Parser - Preserve Format MD",
  "nodes": [
    {
      "id": "start_1",
      "type": "start",
      "position": { "x": 100, "y": 100 },
      "data": { "label": "Início" }
    },
    {
      "id": "variable_1",
      "type": "variable",
      "position": { "x": 300, "y": 100 },
      "data": {
        "label": "HTML Formatado",
        "parameters": {
          "variableName": "formatted",
          "variableValue": "<pre>Linha 1\n\n\nLinha 2\n\n\n\nLinha 3</pre>"
        }
      }
    },
    {
      "id": "parser_1",
      "type": "html_parser",
      "position": { "x": 500, "y": 100 },
      "data": {
        "label": "Com Preserve",
        "parameters": {
          "inputVariable": "formatted",
          "parseMode": "markdown",
          "preserveFormatting": true,
          "outputVariable": "md_formatted"
        }
      }
    },
    {
      "id": "message_1",
      "type": "message",
      "position": { "x": 700, "y": 100 },
      "data": {
        "label": "Ver",
        "parameters": {
          "message": "```\n{{md_formatted}}\n```"
        }
      }
    },
    {
      "id": "end_1",
      "type": "end",
      "position": { "x": 900, "y": 100 },
      "data": { "label": "Fim" }
    }
  ],
  "edges": [
    { "source": "start_1", "target": "variable_1" },
    { "source": "variable_1", "target": "parser_1" },
    { "source": "parser_1", "target": "message_1" },
    { "source": "message_1", "target": "end_1" }
  ]
}

Teste: Esperado: Markdown com todas as quebras de linha preservadas

O que é: Extrai lista de todos os links encontrados e armazena em metadata.

Padrão: false

Flow completo para testar:

{
  "name": "Teste HTML Parser - Extract Links MD",
  "nodes": [
    {
      "id": "start_1",
      "type": "start",
      "position": { "x": 100, "y": 100 },
      "data": { "label": "Início" }
    },
    {
      "id": "variable_1",
      "type": "variable",
      "position": { "x": 300, "y": 100 },
      "data": {
        "label": "HTML com Links",
        "parameters": {
          "variableName": "html_links",
          "variableValue": "<p><a href='https://site1.com'>Site 1</a> e <a href='https://site2.com'>Site 2</a></p>"
        }
      }
    },
    {
      "id": "parser_1",
      "type": "html_parser",
      "position": { "x": 500, "y": 100 },
      "data": {
        "label": "Parse com Links",
        "parameters": {
          "inputVariable": "html_links",
          "parseMode": "markdown",
          "extractLinks": true,
          "outputVariable": "md",
          "metadataVariable": "meta"
        }
      }
    },
    {
      "id": "message_1",
      "type": "message",
      "position": { "x": 700, "y": 100 },
      "data": {
        "label": "Mostrar",
        "parameters": {
          "message": "Markdown: {{md}}\n\nLinks encontrados: {{meta.links}}"
        }
      }
    },
    {
      "id": "end_1",
      "type": "end",
      "position": { "x": 900, "y": 100 },
      "data": { "label": "Fim" }
    }
  ],
  "edges": [
    { "source": "start_1", "target": "variable_1" },
    { "source": "variable_1", "target": "parser_1" },
    { "source": "parser_1", "target": "message_1" },
    { "source": "message_1", "target": "end_1" }
  ]
}

Teste: Esperado: Markdown + array com ["https://site1.com", "https://site2.com"]

extractImages (boolean, opcional)

O que é: Extrai lista de todas as imagens (src) encontradas.

Padrão: false

Flow completo para testar:

{
  "name": "Teste HTML Parser - Extract Images MD",
  "nodes": [
    {
      "id": "start_1",
      "type": "start",
      "position": { "x": 100, "y": 100 },
      "data": { "label": "Início" }
    },
    {
      "id": "variable_1",
      "type": "variable",
      "position": { "x": 300, "y": 100 },
      "data": {
        "label": "HTML com Imagens",
        "parameters": {
          "variableName": "html_imgs",
          "variableValue": "<div><img src='img1.jpg' alt='Foto 1'><img src='img2.png' alt='Foto 2'></div>"
        }
      }
    },
    {
      "id": "parser_1",
      "type": "html_parser",
      "position": { "x": 500, "y": 100 },
      "data": {
        "label": "Parse com Imagens",
        "parameters": {
          "inputVariable": "html_imgs",
          "parseMode": "markdown",
          "extractImages": true,
          "outputVariable": "md",
          "metadataVariable": "meta"
        }
      }
    },
    {
      "id": "message_1",
      "type": "message",
      "position": { "x": 700, "y": 100 },
      "data": {
        "label": "Resultado",
        "parameters": {
          "message": "Markdown:\n{{md}}\n\nImagens: {{meta.images}}"
        }
      }
    },
    {
      "id": "end_1",
      "type": "end",
      "position": { "x": 900, "y": 100 },
      "data": { "label": "Fim" }
    }
  ],
  "edges": [
    { "source": "start_1", "target": "variable_1" },
    { "source": "variable_1", "target": "parser_1" },
    { "source": "parser_1", "target": "message_1" },
    { "source": "message_1", "target": "end_1" }
  ]
}

Teste: Esperado: Markdown com sintaxe de imagem + array ["img1.jpg", "img2.png"]

metadataVariable (string, opcional)

O que é: Variável para armazenar metadados (links, imagens, tamanhos).

Padrão: Não define

Flow completo para testar:

{
  "name": "Teste HTML Parser - Metadata MD",
  "nodes": [
    {
      "id": "start_1",
      "type": "start",
      "position": { "x": 100, "y": 100 },
      "data": { "label": "Início" }
    },
    {
      "id": "variable_1",
      "type": "variable",
      "position": { "x": 300, "y": 100 },
      "data": {
        "label": "HTML",
        "parameters": {
          "variableName": "html",
          "variableValue": "<h1>Título</h1><p>Conteúdo com <strong>ênfase</strong>.</p>"
        }
      }
    },
    {
      "id": "parser_1",
      "type": "html_parser",
      "position": { "x": 500, "y": 100 },
      "data": {
        "label": "Parse",
        "parameters": {
          "inputVariable": "html",
          "parseMode": "markdown",
          "outputVariable": "md",
          "metadataVariable": "info"
        }
      }
    },
    {
      "id": "message_1",
      "type": "message",
      "position": { "x": 700, "y": 100 },
      "data": {
        "label": "Ver Info",
        "parameters": {
          "message": "MD: {{md}}\n\nOriginal: {{info.originalLength}} chars\nFinal: {{info.parsedLength}} chars"
        }
      }
    },
    {
      "id": "end_1",
      "type": "end",
      "position": { "x": 900, "y": 100 },
      "data": { "label": "Fim" }
    }
  ],
  "edges": [
    { "source": "start_1", "target": "variable_1" },
    { "source": "variable_1", "target": "parser_1" },
    { "source": "parser_1", "target": "message_1" },
    { "source": "message_1", "target": "end_1" }
  ]
}

Teste: Esperado: Markdown + estatísticas de tamanho

Parâmetros

Campo Tipo Obrigatório Descrição
inputVariable string Sim Variável contendo HTML a converter
parseMode string Sim Modo de parsing (use "markdown")
outputVariable string Não Variável para resultado (padrão: "parsed_content")
removeScripts boolean Não Remove scripts (padrão: true)
removeStyles boolean Não Remove styles (padrão: true)
preserveFormatting boolean Não Preserva quebras de linha (padrão: false)
extractLinks boolean Não Extrai lista de links (padrão: false)
extractImages boolean Não Extrai lista de imagens (padrão: false)
metadataVariable string Não Variável para metadados

Exemplo 1: Converter Artigo para GitHub

Objetivo: Converter artigo HTML em Markdown para publicar no GitHub

JSON para Importar

{
  "name": "Artigo HTML para GitHub Markdown",
  "nodes": [
    {
      "id": "start_1",
      "type": "start",
      "position": { "x": 100, "y": 100 },
      "data": { "label": "Início" }
    },
    {
      "id": "variable_1",
      "type": "variable",
      "position": { "x": 300, "y": 100 },
      "data": {
        "label": "Artigo HTML",
        "parameters": {
          "variableName": "artigo_html",
          "variableValue": "<article><h1>Como usar Markdown</h1><p>Markdown é uma <strong>linguagem de marcação</strong> simples.</p><h2>Benefícios</h2><ul><li>Fácil de escrever</li><li>Fácil de ler</li><li>Portável</li></ul><p>Veja mais em <a href='https://www.markdownguide.org'>Markdown Guide</a>.</p></article>"
        }
      }
    },
    {
      "id": "parser_1",
      "type": "html_parser",
      "position": { "x": 500, "y": 100 },
      "data": {
        "label": "HTML → Markdown",
        "parameters": {
          "inputVariable": "artigo_html",
          "parseMode": "markdown",
          "extractLinks": true,
          "outputVariable": "artigo_md",
          "metadataVariable": "stats"
        }
      }
    },
    {
      "id": "message_1",
      "type": "message",
      "position": { "x": 700, "y": 100 },
      "data": {
        "label": "Resultado",
        "parameters": {
          "message": "📝 Markdown gerado:\n\n{{artigo_md}}\n\n🔗 Links: {{stats.links}}"
        }
      }
    },
    {
      "id": "end_1",
      "type": "end",
      "position": { "x": 900, "y": 100 },
      "data": { "label": "Fim" }
    }
  ],
  "edges": [
    { "source": "start_1", "target": "variable_1" },
    { "source": "variable_1", "target": "parser_1" },
    { "source": "parser_1", "target": "message_1" },
    { "source": "message_1", "target": "end_1" }
  ]
}

Saída esperada:

Sistema: 📝 Markdown gerado:

# Como usar Markdown

Markdown é uma **linguagem de marcação** simples.

## Benefícios

- Fácil de escrever
- Fácil de ler
- Portável

Veja mais em [Markdown Guide](https://www.markdownguide.org).

🔗 Links: ["https://www.markdownguide.org"]

Exemplo 2: Email HTML para Notificação Slack

Objetivo: Converter email HTML em Markdown para enviar via Slack

JSON para Importar

{
  "name": "Email HTML para Slack Markdown",
  "nodes": [
    {
      "id": "start_1",
      "type": "start",
      "position": { "x": 100, "y": 100 },
      "data": { "label": "Início" }
    },
    {
      "id": "variable_1",
      "type": "variable",
      "position": { "x": 300, "y": 100 },
      "data": {
        "label": "Email HTML",
        "parameters": {
          "variableName": "email_html",
          "variableValue": "<div><h2>Nova Venda!</h2><p><strong>Cliente:</strong> João Silva</p><p><strong>Valor:</strong> R$ 1.500,00</p><p><em>Pagamento aprovado</em></p></div>"
        }
      }
    },
    {
      "id": "parser_1",
      "type": "html_parser",
      "position": { "x": 500, "y": 100 },
      "data": {
        "label": "Converter para MD",
        "parameters": {
          "inputVariable": "email_html",
          "parseMode": "markdown",
          "outputVariable": "mensagem_md"
        }
      }
    },
    {
      "id": "slack_1",
      "type": "webhook",
      "position": { "x": 700, "y": 100 },
      "data": {
        "label": "Enviar Slack",
        "parameters": {
          "url": "https://hooks.slack.com/services/YOUR/WEBHOOK/URL",
          "method": "POST",
          "body": "{\"text\": \"{{mensagem_md}}\"}"
        }
      }
    },
    {
      "id": "message_1",
      "type": "message",
      "position": { "x": 900, "y": 100 },
      "data": {
        "label": "Confirmar",
        "parameters": {
          "message": "✅ Notificação enviada para Slack"
        }
      }
    },
    {
      "id": "end_1",
      "type": "end",
      "position": { "x": 1100, "y": 100 },
      "data": { "label": "Fim" }
    }
  ],
  "edges": [
    { "source": "start_1", "target": "variable_1" },
    { "source": "variable_1", "target": "parser_1" },
    { "source": "parser_1", "target": "slack_1" },
    { "source": "slack_1", "target": "message_1" },
    { "source": "message_1", "target": "end_1" }
  ]
}

Saída esperada:

Sistema: ✅ Notificação enviada para Slack
(No Slack aparece: ## Nova Venda!\n\n**Cliente:** João Silva\n\n**Valor:** R$ 1.500,00\n\n*Pagamento aprovado*)

Exemplo 3: Documentação Web para Notion

Objetivo: Extrair e converter documentação HTML para importar no Notion

JSON para Importar

{
  "name": "Docs HTML para Notion Markdown",
  "nodes": [
    {
      "id": "start_1",
      "type": "start",
      "position": { "x": 100, "y": 100 },
      "data": { "label": "Início" }
    },
    {
      "id": "scraper_1",
      "type": "web_scraper",
      "position": { "x": 300, "y": 100 },
      "data": {
        "label": "Buscar Docs",
        "parameters": {
          "url": "https://docs.example.com/guide",
          "outputVariable": "docs_html"
        }
      }
    },
    {
      "id": "parser_1",
      "type": "html_parser",
      "position": { "x": 500, "y": 100 },
      "data": {
        "label": "HTML → Markdown",
        "parameters": {
          "inputVariable": "docs_html",
          "parseMode": "markdown",
          "extractLinks": true,
          "extractImages": true,
          "outputVariable": "docs_md",
          "metadataVariable": "recursos"
        }
      }
    },
    {
      "id": "notion_1",
      "type": "notion_create_page",
      "position": { "x": 700, "y": 100 },
      "data": {
        "label": "Criar no Notion",
        "parameters": {
          "databaseId": "YOUR_DATABASE_ID",
          "title": "Documentação Importada",
          "content": "{{docs_md}}"
        }
      }
    },
    {
      "id": "message_1",
      "type": "message",
      "position": { "x": 900, "y": 100 },
      "data": {
        "label": "Confirmar",
        "parameters": {
          "message": "✅ Documentação importada\n📎 {{recursos.links}} links\n🖼️ {{recursos.images}} imagens"
        }
      }
    },
    {
      "id": "end_1",
      "type": "end",
      "position": { "x": 1100, "y": 100 },
      "data": { "label": "Fim" }
    }
  ],
  "edges": [
    { "source": "start_1", "target": "scraper_1" },
    { "source": "scraper_1", "target": "parser_1" },
    { "source": "parser_1", "target": "notion_1" },
    { "source": "notion_1", "target": "message_1" },
    { "source": "message_1", "target": "end_1" }
  ]
}

Saída esperada:

Sistema: ✅ Documentação importada
📎 ["https://example.com/ref1", "https://example.com/ref2"] links
🖼️ ["https://example.com/img1.png"] imagens

Resposta do Node

{
  "success": true,
  "data": {
    "parsed_content": "# Título\n\nConteúdo em **Markdown**",
    "metadata": {
      "links": ["https://example.com"],
      "images": ["image.jpg"],
      "originalLength": 250,
      "parsedLength": 35
    },
    "stats": {
      "originalLength": 250,
      "parsedLength": 35,
      "mode": "markdown",
      "hasLinks": 1,
      "hasImages": 1
    }
  },
  "executionTime": 52,
  "logs": [
    "Parsed HTML in markdown mode",
    "Original: 250 chars → Parsed: 35 chars",
    "Found 1 links",
    "Found 1 images"
  ]
}

Boas Práticas

SIM:

  • Use para integrar HTML com plataformas que suportam Markdown (GitHub, Discord, Slack, Notion)
  • Combine com web_scraper para extrair e converter conteúdo web
  • Use extractLinks e extractImages quando precisar processar recursos referenciados
  • Mantenha removeScripts e removeStyles como true para segurança
  • Use metadataVariable para validar qualidade da conversão

NÃO:

  • Não use se precisar apenas texto puro sem formatação (use parse_text)
  • Não use para extrair dados estruturados (use parse_structured)
  • Não confie em conversão perfeita de HTML complexo (sempre revise)
  • Não desative removeScripts por questões de segurança

Dicas

💡 Dica 1: O TurndownService preserva negrito (strong/b), itálico (em/i), links, listas (ul/ol), headings (#) e code blocks

💡 Dica 2: Elementos HTML não convencionais podem não converter perfeitamente - teste com seu HTML específico

💡 Dica 3: Use preserveFormatting: false (padrão) para Markdown limpo e consistente

💡 Dica 4: Combine com FORMATTER para pós-processar o Markdown gerado se necessário

💡 Dica 5: O sistema remove automaticamente nav, header, footer, aside e elementos de navegação para focar no conteúdo principal

Próximo Node

PARSE_TEXT - Extrai apenas texto puro sem formatação → PARSE_STRUCTURED - Extrai estrutura organizada (headings, listas, tabelas) → PARSE_CUSTOM - Extrai elementos específicos com seletores CSS