Markdown#
The Markdown node converts between Markdown and HTML formats.
操作#
该节点的操作有模式:
- Markdown to HTML: Use this mode to convert from Markdown to HTML.
- HTML to Markdown: Use this mode to convert from HTML to Markdown.
节点参数#
- HTML or Markdown: Enter the data you want to convert. The field name changes based on which Mode you select.
- 目标键: 输入您想要放置输出的字段。使用点号指定嵌套字段,例如
level1.level2.newKey。
节点选项#
节点的选项取决于所选的模式。
测试选项
某些选项相互依赖或可能产生交互影响。我们建议测试这些选项以确认效果符合预期。
Markdown to HTML options#
| 选项 | 描述 | 默认值 |
|---|---|---|
| 链接是否新窗口打开 | 是否在新窗口中打开链接(启用)或当前窗口打开(禁用)。 | 禁用 |
| 自动链接到URL | 是否自动将URL转换为链接(启用)或不转换(禁用)。如果启用,n8n会将任何识别为URL的字符串转换为链接。 | 禁用 |
| Backslash Escapes HTML Tags | Whether to allow backslash escaping of HTML tags (enabled) or not (disabled). When enabled, n8n escapes any < or > prefaced with \. For example, \<div\> renders as <div>. |
Disabled |
| Complete HTML Document | Whether to output a complete HTML document (enabled) or an HTML fragment (disabled). A complete HTML document includes the <DOCTYPE HTML> declaration, <html> and <body> tags, and the <head> element. |
Disabled |
| Customized Header ID | Whether to support custom heading IDs (enabled) or not (disabled). When enabled, you can add custom heading IDs using {header ID here} after the heading text. |
Disabled |
| 表情符号支持 | 是否支持表情符号(启用)或不支持(禁用)。 | 已禁用。 |
| 编码电子邮件 | 是否将ASCII字符电子邮件转换为其等效的十进制实体(启用)或不转换(禁用)。 | 启用 |
| 排除URL末尾标点符号 | 是否从自动链接的URL中排除末尾标点符号(启用)或不排除(禁用)。需与自动链接到URL功能配合使用。 | 禁用 |
| GitHub 代码块 | 是否启用 GitHub 风格的 Markdown 代码块(启用)或不启用(禁用)。 | 已启用 |
| GitHub Compatible Header IDs | Whether to generate GitHub Flavored Markdown heading IDs (enabled) or not (disabled). GitHub Flavored Markdown generates heading IDs with - in place of spaces and removes non-alphanumeric characters. |
Disabled |
| GitHub 提及链接 | 更改与GitHub提及功能一起使用的链接。 | 已禁用 |
| GitHub Mentions | Whether to support tagging GitHub users with @ (enabled) or not (disabled). When enabled, n8n replaces @name with https://github.com/name. |
Disabled |
| GitHub任务清单 | 是否支持GitHub风格的Markdown任务列表(启用)或不支持(禁用)。 | 禁用 |
| Header Level Start | Number. Set the start level for headers. For example, changing this field to 2 causes n8n to treat # as <h2>, ## as <h3>, and so on. |
1 |
| Mandatory Space Before Header | Whether to make a space between # and heading text required (enabled) or not (disabled). When enabled, n8n renders a heading written as ##Some header text literally (it doesn't turn it into a heading element) |
Disabled |
| 单词中间星号处理 | 设置n8n是否将单词中的星号视为Markdown语法(禁用)或直接显示为星号字符(启用)。 | 禁用 |
| 单词中间下划线 | n8n是否应将单词中的下划线视为Markdown(禁用)或将其渲染为字面下划线(启用)。 | 禁用 |
| 无标题ID | 禁用自动生成标题ID功能(默认启用)。 | 已禁用 |
| 解析图片尺寸 | 支持在Markdown语法中设置最大图片尺寸(已启用)。 | 已禁用 |
| 前缀头ID | 定义要添加到头ID的前缀。 | None |
| Raw Header ID | Whether to remove spaces, ', and " from header IDs, including prefixes, replacing them with - (enabled) or not (disabled). |
Disabled |
| 原始前缀头ID | 是否阻止n8n修改头前缀(启用)或不阻止(禁用) | 禁用 |
| 简单换行 | 是否在行尾不使用双空格的情况下创建换行(启用)或不创建(禁用)。 | 禁用 |
| 智能缩进修复 | 是否尝试智能修复与ES6模板字符串相关的缩进问题(启用)或不修复(禁用)。 | Disabled |
| 缩进子列表 | 是否移除子列表需要缩进四个空格的要求(启用)或保留(禁用)。 | 禁用 |
| Split Adjacent Blockquotes | Whether to split adjacent blockquote blocks (enabled) or not (disabled). If you don't enable this, n8n treats quotes (indicated by > at the start of the line) on separate lines as a single blockquote, even when separated by an empty line. |
Disabled |
| Strikethrough | Whether to support strikethrough syntax (enabled) or not (disabled). When enabled, you can add a ~~strikethrough~~ effect using ~~ around the word or phrase. |
Disabled |
| 表格标题ID | 是否在表格标题标签中添加ID(启用)或不添加(禁用)。 | 禁用 |
| 表格支持 | 是否支持表格(启用)或不支持(禁用)。 | 禁用 |
HTML to Markdown options#
| 选项 | 描述 | 默认值 |
|---|---|---|
| 项目符号标记 | 指定用于无序列表的字符。 | * |
| 代码块围栏 | 指定用于代码块的字符。 | ``` |
| Emphasis Delimiter | Specify the character <em>. |
_ |
| 全局转义模式 | 覆盖默认的字符转义设置。您可能想改用文本替换模式。 | None |
| Ignored Elements | Ignore given HTML elements, and their children. | None |
| 保留数据中的图片 | 是否保留数据中的图片(启用)或不保留(禁用)。支持最大1MB的文件。 | 禁用 |
| 行起始转义模式 | 覆盖默认的字符转义设置。您可能希望改用文本替换模式。 | None |
| 最大连续换行数 | 数值。指定允许的最大连续换行数量。 | 3 |
| 将URL置于底部 | 是否将URL放置在页面底部并使用链接引用定义进行格式化(启用)或不进行格式化(禁用)。 | 禁用 |
| Strong Delimiter | Specify the characters for <strong>. |
** |
| 代码块样式 | 指定代码块的样式。选项为Fence和Indented。 | Fence |
| 文本替换模式 | 使用正则表达式定义文本替换模式。 | None |
| Treat As Blocks | Specify HTML elements to treat as blocks (surround with blank lines) | None |
模板和示例#
解析器#
n8n 使用以下解析器:
- To convert from HTML to Markdown: node-html-markdown.
- To convert from Markdown to HTML: Showdown. Some options allow you to extend your Markdown with GitHub Flavored Markdown.