Markdown#
Markdown 节点用于在 Markdown 和 HTML 格式之间进行转换。
🌐 The Markdown node converts between Markdown and HTML formats.
操作(Operations)#
此节点的操作为模式:
🌐 This node's operations are Modes:
- Markdown 转 HTML:使用此模式将 Markdown 转换为 HTML。
- HTML 转 Markdown:使用此模式将 HTML 转换为 Markdown。
节点参数(Node parameters)#
- HTML 或 Markdown:输入你想要转换的数据。字段名称会根据你选择的 模式 而变化。
- 目标键:输入你想放置输出的字段。使用点号指定嵌套字段,例如
level1.level2.newKey。
节点选项(Node options)#
该节点的选项取决于所选的模式。
🌐 The node's Options depend on the Mode selected.
试用这些选项
有些选项相互依赖或可能相互作用。我们建议先测试这些选项,以确认效果是否符合你的预期。
Markdown 转 HTML 选项(Markdown to HTML options)#
| Option | Description | Default |
|---|---|---|
| Add Blank To Links | Whether to open links a new window (enabled) or not (disabled). | Disabled |
| Automatic Linking To URLs | Whether to automatically link to URLs (enabled) or not (disabled). If enabled, n8n converts any string that it identifies as a URL to a link. | Disabled |
| 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 |
| Emoji Support | Whether to support emojis (enabled) or not (disabled). | Disabled. |
| Encode Emails | Whether to transform ASCII character emails into their equivalent decimal entities (enabled) or not (disabled). | Enabled |
| Exclude Trailing Punctuation From URLs | Whether to exclude trailing punctuation from automatically linked URLs (enabled) or not (disabled). For use with Automatic Linking To URLs. | Disabled |
| GitHub Code Blocks | Whether to enable GitHub Flavored Markdown code blocks (enabled) or not (disabled). | Enabled |
| 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 Mention Link | Change the link used with GitHub Mentions. | Disabled |
| 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 Task Lists | Whether to support GitHub Flavored Markdown task lists (enabled) or not (disabled). | Disabled |
| 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 |
| Middle Word Asterisks | Whether n8n should treat asterisks in words as Markdown (disabled) or render them as literal asterisks (enabled). | Disabled |
| Middle Word Underscores | Whether n8n should treat underscores in words as Markdown (disabled) or render them as literal underscores (enabled). | Disabled |
| No Header ID | Disable automatic generation of header IDs (enabled). | Disabled |
| Parse Image Dimensions | Support setting maximum image dimensions in Markdown syntax (enabled). | Disabled |
| Prefix Header ID | Define a prefix to add to header IDs. | None |
| Raw Header ID | Whether to remove spaces, ', and " from header IDs, including prefixes, replacing them with - (enabled) or not (disabled). |
Disabled |
| Raw Prefix Header ID | Whether to prevent n8n from modifying header prefixes (enabled) or not (disabled) | Disabled |
| Simple Line Breaks | Whether to create line breaks without a double space at the end of a line (enabled) or not (disabled). | Disabled |
| Smart Indentation Fix | Whether to try to smartly fix indentation problems related to ES6 template strings in indented code blocks (enabled) or not (disabled). | Disabled |
| Spaces Indented Sublists | Whether to remove the requirement to indent sublists four spaces (enabled) or not (disabled). | 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 |
| Tables Header ID | Whether to add an ID to table header tags (enabled) or not (disabled). | Disabled |
| Tables Support | Whether to support tables (enabled) or not (disabled). | Disabled |
HTML 转 Markdown 选项(HTML to Markdown options)#
| 选项 | 描述 | 默认值 |
|---|---|---|
| 项目符号标记 | 指定用于无序列表的字符。 | * |
| 代码块分隔符 | 指定用于代码块的字符。 | ``` |
| Emphasis Delimiter | Specify the character <em>. |
_ |
| Global Escape Pattern | Overrides the default character escape settings. You may want to use Text Replacement Pattern instead. | None |
| Ignored Elements | Ignore given HTML elements, and their children. | None |
| Keep Images With Data | Whether to keep images with data (enabled) or not (disabled). Support files up to 1MB. | Disabled |
| Line Start Escape Pattern | Overrides the default character escape settings. You may want to use Text Replacement Pattern instead. | None |
| Max Consecutive New Lines | Number. Specify the maximum number of consecutive new lines allowed. | 3 |
| Place URLs At The Bottom | Whether to place URLs at the bottom of the page and format using link reference definitions (enabled) or not (disabled). | Disabled |
| Strong Delimiter | Specify the characters for <strong> |
|
| 代码块样式 | 指定代码块的样式。选项有 分隔符 和 缩进。 | 分隔符 |
| 文本替换模式 | 使用正则表达式定义文本替换模式。 | 无 |
| 作为块处理 | 指定要作为块处理的 HTML 元素(用空行隔开)。 | 无 |
模板和示例(Templates and examples)#
解析器(Parsers)#
n8n 使用以下解析器:
🌐 n8n uses the following parsers:
- 将 HTML 转换为 Markdown: node-html-markdown。
- 要将 Markdown 转换为 HTML:Showdown。一些选项允许你使用 GitHub 风格的 Markdown 扩展你的 Markdown。