Nodes/ComfyUI-QG-tools/加载文档
ComfyUI Node

加载文档

Prompt files on disk, loaded as text — no retyping

By live1617·Created 9 days ago·Updated a day ago· 1
加载文档
    • text
    ◄md_file<no document>►
    ◄modeplain►
    ◄custom_path►

    If you've ever kept a "good prompts" note somewhere and copy-pasted out of it into a CLIP Text Encode box, this node is for you. 加载文档 (QG_MDReader) reads a Markdown or plain text file and outputs its contents as a STRING, with the document previewed on the node so you can see what you're about to send.

    That sounds like a small thing. It stops being small the moment your prompt is 400 words of structured instructions for an LLM node - the kind of thing the KB documents as the normal workflow for instruction-following encoders - because editing that inside a ComfyUI widget is miserable and version-controlling it is impossible. On disk it's a file you edit in a real editor, diff, and back up.

    How it works

    The dropdown lists documents it finds in ComfyUI's input folder, plus the md, markdown, prompts and prompt subfolders beside it. Extensions it will show: .md, .markdown, .mdown, .mdx, .txt. Drop a file in one of those places, press the refresh button on the node, and it appears in the list.

    mode is the setting that decides whether this is a document or a prompt:

    • plain - the Markdown syntax is stripped: headings lose their #, list bullets go, table pipes go, link syntax collapses to its text. What comes out reads like prose, which is what you want when the output feeds a text encoder that has no idea what Markdown is.
    • raw - the file exactly as written, marks and all. Right when the downstream node is an LLM being asked to follow a formatted brief, or when you're chaining into something that parses structure.

    custom_path is the escape hatch: fill in an absolute path and it wins over the dropdown entirely. Point it at a file outside ComfyUI - a synced notes folder, a git checkout of prompt files - and you keep the whole workflow while storing your text wherever you like.

    The preview is real, not a thumbnail: you can switch between a rendered view and a plain-text view, zoom, and copy the content out. If plain mode is mangling something you expected to survive, that's where you'll see it before wasting a generation on it.

    Inputs and outputs

    • md_file (required, enum) - the file list; shows <no document> when it finds nothing.
    • mode (required, enum: plain / raw, default plain)
    • custom_path (optional, STRING) - absolute path, beats the list.
    • Output text (STRING) - the document's contents.

    Wire it into anything that takes a string: a converted prompt input, the instruction field on an LLM or prompt-rewriting node, a save-filename prefix, or one of this pack's text tools if you want to slice it up.

    Install

    cd ComfyUI/custom_nodes
    git clone https://github.com/live1617/ComfyUI-QG-tools
    

    Full restart; the console reports [QG-tools] v0.9.2 加载完成 | 节点数 24. Manager search ComfyUI-QG-Tools where the registry entry is live. No pip dependencies - the pack's requirements file is comments-only on purpose. The node registers three backend routes for listing and previewing documents, which is why a restart (not a page refresh) is what makes it appear.

    This node is the pack author's own work rather than a port - it came from their separate ComfyUI-MD-Reader plugin, and the display name stayed Chinese because that's the name people know it by. Search md, markdown, document or 加载文档.

    Where people get burned

    Nothing in the dropdown. The list is built from the folders at load time, so a file dropped in while ComfyUI is running needs the node's refresh button, and occasionally a restart before it shows. Also check which input folder - if you run multiple ComfyUI installs, or a portable build, it's easy to drop the file in the wrong one.

    Plain mode eats more than you expect. It's a Markdown stripper, not a smart filter. Prompt syntax that looks like Markdown - **emphasis**, _underscores_, a line starting with - - will get chewed. If your text has deliberate symbols, use raw.

    Editing the file doesn't rerun anything. ComfyUI caches nodes whose inputs haven't changed, and a file's contents are not an input as far as the graph is concerned - only the filename string is. Change the text, change nothing else, and you can queue a run that reuses the old value. Nudge mode back and forth, or touch another widget, to force it through. This one wastes an afternoon for everybody exactly once.

    Path with spaces. custom_path is passed through as-is; a Windows path with backslashes and spaces is fine if quoted correctly in whatever wrote the workflow, but check it's not being mangled before assuming the node is broken.

    CategoryQG-tools/文本

    Inputs (3)

    NameTypeDefaultDescription
    md_fileCOMBO<no document>Drop .md files into ComfyUI's input folder, then press the refresh button on the node.
    modeCOMBOplainplain: strip the Markdown marks so the text reads as a prompt. raw: the file, untouched.
    custom_pathoptSTRINGLeave empty to use the list. Filled in, it wins over the list.

    Outputs (1)

    NameTypeDescription
    textSTRINGThe document's text, ready for any STRING input.