md → md转html
AI-generatedOverview
This node converts Markdown (MD) content into HTML format with customizable styling options. It is particularly useful for users who want to transform Markdown text into styled HTML for web publishing, newsletters, or content management systems. The node supports themes, font styles, font sizes, color schemes, and syntax highlighting for code blocks, making it ideal for generating visually appealing HTML from Markdown source.
Practical examples include:
- Converting blog post drafts written in Markdown into ready-to-publish HTML.
- Styling technical documentation with syntax-highlighted code snippets.
- Preparing Markdown content for WeChat public accounts or other platforms requiring specific HTML formatting.
Properties
| Name | Meaning |
|---|---|
| content | The Markdown text content to be converted to HTML. Default example: "## 标题" (a level 2 heading). |
| 主题 (MD__theme) | Theme style of the output HTML. Options: 经典 (default), 优雅 (grace), 简洁 (simple). |
| 字体 (fonts) | Font family used in the output HTML. Options: 无衬线 (sans-serif fonts), 衬线 (serif fonts), 等宽 (monospace fonts). |
| 字号 (size) | Font size in pixels for the output HTML text. Number between 12 and 60, default 14. |
| 主题色 (color) | Primary theme color used in the HTML styling. Options include classic blue (#0F4C81), emerald green (#009874), vibrant orange (#FA5151), lemon yellow (#FECE00), lavender purple (#92617E), sky blue (#55C9EA), rose gold (#B76E79), olive green (#556B2F), graphite black (#333333), smoky gray (#A9A9A9), cherry blossom pink (#FFB7C5). |
| 代码块主题 (codeBlockTheme) | URL to a CSS stylesheet for syntax highlighting of code blocks. Many popular Highlight.js themes are available, such as "tomorrow-night-bright", "github-dark", "atom-one-light", etc. Defaults to "tomorrow-night-bright". |
| Mac 代码块 (isMacCodeBlock) | Boolean flag indicating whether to use Mac-style code block appearance. Default true. |
| 公众号模式 (gzh) | Boolean flag to enable WeChat public account mode, which may adjust HTML output for compatibility. Default false. |
| 微信外链转底部引用 (isCiteStatus) | Boolean flag to convert external WeChat links into bottom citations. Only shown if 公众号模式 is true. Default false. |
| 段落首行缩进 (__css_content) | Boolean flag to enable first-line indentation in paragraphs. Default true. |
| 字数统计 (countStatus) | Boolean flag to enable word count statistics in the output. Default true. |
Output
The node outputs an array of JSON objects where each item contains the converted HTML content corresponding to the input Markdown. The key json holds the main data structure, typically including the generated HTML string.
If binary data output is supported (not explicitly stated here), it would represent the HTML file or related assets, but this node primarily focuses on JSON output with HTML content.
Dependencies
- This node relies on internal helper functions and a resource-operation mapping system to perform the Markdown to HTML conversion.
- It uses external CSS stylesheets hosted on CDN URLs for code block syntax highlighting.
- No explicit external API keys or credentials are required.
- The node expects certain configuration files or resources bundled within its directory for theme and operation definitions.
Troubleshooting
- Common issues:
- If the specified resource or operation is not implemented, the node throws an error indicating the method is not realized.
- Incorrect or missing Markdown content input can result in empty or malformed HTML output.
- Invalid URLs for code block themes may cause syntax highlighting styles not to load properly.
- Error messages:
"未实现方法: md_source.md转html"(Method not implemented): Indicates the requested resource-operation pair is not defined; verify the resource and operation names.- Errors during function calls will be logged with details; enabling "Continue On Fail" allows processing subsequent items despite errors.
- Resolutions:
- Ensure correct resource and operation names are selected.
- Provide valid Markdown content.
- Use valid URLs for code block theme CSS files.
- Check network access to CDN URLs if syntax highlighting styles fail to load.
Links and References
- Highlight.js Styles
- Markdown Guide
- WeChat Official Account Platform (for understanding 公众号模式 context)
