Nodes/RUI-Nodes/Markdown转图片 / Markdown To Image
ComfyUI Node

Markdown转图片 / Markdown To Image

Turn Markdown into a share-ready image without leaving ComfyUI

By rui40000·Created 3 years ago·Updated about 8 hours ago· 17
Markdown转图片 / Markdown To Image
    • image
    markdown# Markdown 转图片 支持 **粗体**、*斜体*、`行内代码`、~~删除线~~ 与 [链接](https://example.com)。 ## 列表与任务 ✅ - 第一项:支持 Emoji 😀🎉 - 第二项 - 嵌套子项 - [x] 已完成任务 - [ ] 待办任务 ## 表格 📊 | 模型 | 输入价 | 输出价 | |:-----|:------:|-------:| | GPT 🤖 | $0.2/M | $1.25/M | | Claude 🧠 | $10/M | $50/M | > 引用块:优雅的细节,来自阅读器级的排版。 ```python def hello(): print("Hello, Markdown!") ```
    size_preset1080×1440 竖版 3:4
    width1080
    height1440
    font(内置默认字体,请向 Ruinode/font 放入 ttf)
    theme浅色 light
    body_sizeauto
    h1_sizeauto
    h2_sizeauto
    h3_sizeauto
    h4_sizeauto
    h5_sizeauto
    h6_sizeauto
    letter_spacingauto
    line_spacingauto
    max_chars_per_lineauto

    Your LLM node just handed you a wall of Markdown and you need it as an image - a card for Xiaohongshu, an A4 printout, a 1200×630 link cover. That's this node's whole job: feed it Markdown, get a rendered IMAGE out, with typography that actually looks like a reader, not a text dump pasted onto a canvas.

    It comes from RUI-Nodes (Rui-Node🐶), a Chinese-authored utility pack that mostly lives on sprite tooling and matting. This text-side node is one of its friendlier corners, and it's pure PIL - no model weights, no GPU, no hidden downloads.

    What it actually renders

    The visual spec is deliberately GitHub / Typora-flavored. Headings scale 2.0/1.5/1.25/1.0/0.875/0.85× the body size, H1 and H2 get the divider rule, blockquotes get the left bar, code blocks get rounded corners plus a language tag, and tables come with the header fill, zebra rows and column alignment you expect. Task-list checkboxes and colored emoji work too - emoji render via your system's color fonts, so no mojibake squares.

    Everything sits on pure PIL, which is the clever part: no browser, no Playwright, no HTML-to-image dependency chain to babysit. The size fields (body_size, h1_sizeh6_size, letter_spacing, line_spacing, max_chars_per_line) default to auto, and the node binary-searches the font size to "just fill" your canvas instead of guessing. It'll shrink the font to fit rather than crop your content.

    The inputs that matter

    • markdown - paste straight in. Multiline, so a whole report fits.
    • size_preset - nine quick picks: 1080×1440 (3:4), 1080×1920 (9:16), 1080×1080, 1920×1080, 1280×720, 1200×630 link cover, A4 portrait, and more. Pick custom and width/height (64–8192px) only when you need something exact.
    • font - drops from the Ruinode/font directory. Drop a ttf/otf/ttc in there, refresh the page, it appears. A same-family bold file (like msyhbd) pairs up automatically for bold text; without one it fakes bold with a stroke.
    • theme - light / dark / sepia. Dark reads well for code-heavy cards.

    Output: one image (IMAGE), sized to whatever you picked.

    The trap everyone hits: WAS Text Multiline

    The author is explicit in the tooltip: don't feed this node from WAS Node Suite's "Text Multiline". That node treats #-prefixed lines as comments and deletes them - your headings vanish silently - and it also does dynamic-prompt substitution. If you need a text carrier upstream, use this pack's 多行文本框(原样输出) / Text Box (Raw) node instead, which passes text through verbatim.

    Installing

    It's part of RUI-Nodes, so the whole pack installs at once:

    ComfyUI Manager → search "RUI-Nodes" → install, restart
    # or manually:
    cd ComfyUI/custom_nodes
    git clone https://github.com/rui40000/RUI-Nodes
    cd RUI-Nodes && pip install -r requirements.txt
    

    Then restart ComfyUI. The requirements file pulls torch, numpy, Pillow and requests, plus diffusers/transformers for the pack's matting nodes - a stock ComfyUI environment usually already has most of it. This node itself adds no dependency beyond PIL.

    If a heading shows up missing, it's almost never the renderer - check what's upstream of the markdown input. And if the output crops text at the bottom, shrink the body size or raise the canvas instead of chasing a phantom setting.

    CategoryRui-Node🐶/文本处理📝

    Inputs (16)

    NameTypeDefaultDescription
    markdownSTRING# Markdown 转图片 支持 **粗体**、*斜体*、`行内代码`、~~删除线~~ 与 [链接](https://example.com)。 ## 列表与任务 ✅ - 第一项:支持 Emoji 😀🎉 - 第二项 - 嵌套子项 - [x] 已完成任务 - [ ] 待办任务 ## 表格 📊 | 模型 | 输入价 | 输出价 | |:-----|:------:|-------:| | GPT 🤖 | $0.2/M | $1.25/M | | Claude 🧠 | $10/M | $50/M | > 引用块:优雅的细节,来自阅读器级的排版。 ```python def hello(): print("Hello, Markdown!") ``` Markdown 原文。支持标题、粗斜体、删除线、行内代码、 代码块、引用、列表、任务清单、表格、链接与彩色 Emoji。 ⚠ 别用 WAS 的「Text Multiline」喂本节点——它会把 # 开头的 标题行当注释删掉。请用本仓库的「多行文本框(原样输出)」。
    size_presetCOMBO1080×1440 竖版 3:4输出尺寸预设。选 custom 时才使用下方的宽高, 选其他预设时下方宽高会被忽略。
    widthINT108064–8192自定义宽度,仅在预设选 custom 时生效。
    heightINT144064–8192自定义高度,仅在预设选 custom 时生效。 内容排不下时会自动缩小字号来适配,而不是裁切。
    fontCOMBO(内置默认字体,请向 Ruinode/font 放入 ttf)正文字体,列表来自 Ruinode/font 目录(ttf/otf/ttc)。 放入新字体后刷新页面即出现。同族粗体文件(如 msyhbd) 会自动配对用于渲染粗体,没有粗体文件时用描边模拟。
    themeCOMBO浅色 light配色主题:浅色适合分享长图,深色适合代码类内容, 米色接近纸质阅读观感。
    body_sizeoptSTRINGauto正文字号(像素)。 填 auto 由节点自动推算,填数值则强制指定。
    h1_sizeoptSTRINGauto一级标题字号。auto 时为正文的 2.0 倍。 填 auto 由节点自动推算,填数值则强制指定。
    h2_sizeoptSTRINGauto二级标题字号。auto 时为正文的 1.5 倍。 填 auto 由节点自动推算,填数值则强制指定。
    h3_sizeoptSTRINGauto三级标题字号。auto 时为正文的 1.25 倍。 填 auto 由节点自动推算,填数值则强制指定。
    h4_sizeoptSTRINGauto四级标题字号。auto 时与正文同大。 填 auto 由节点自动推算,填数值则强制指定。
    h5_sizeoptSTRINGauto五级标题字号。auto 时为正文的 0.875 倍。 填 auto 由节点自动推算,填数值则强制指定。
    h6_sizeoptSTRINGauto六级标题字号。auto 时为正文的 0.85 倍。 填 auto 由节点自动推算,填数值则强制指定。
    letter_spacingoptSTRINGauto字间距(像素),可为负让字更紧凑。 填 auto 由节点自动推算,填数值则强制指定。
    line_spacingoptSTRINGauto行距倍数,1.6 左右最接近阅读器观感; 值越大越松散。 填 auto 由节点自动推算,填数值则强制指定。
    max_chars_per_lineoptSTRINGauto单行最多排多少字,超出即换行。 调小可让版面更窄、更易读。 填 auto 由节点自动推算,填数值则强制指定。

    Outputs (1)

    NameTypeDescription
    imageIMAGE