离线 · 无上传 · 浏览器本地完成Offline · no uploads · runs in the browser
TXT 转 Markdown——本地包成围栏代码块,一字不改TXT to Markdown locally — fenced, not one character changed
这条转换有用恰恰是因为它笨:Markdown 是纯文本的超集,任何 .txt 都可以原样放进 .md 而不改变含义;但反过来,"把你的日志、表格、诗歌自动认成 Markdown 结构"就必然要靠猜。猜错很贵——一旦识别出标题与列表,原来的缩进、连续空格与对齐就全没了。所以这一条只做一件不会错的事:加一层围栏。要结构,请自己写那几行标记,或者从真的有结构的源(Word / HTML / CSV)出发。This conversion is useful precisely because it is dumb: Markdown is a superset of plain text, so any .txt can enter a .md unchanged in meaning, while "recognising your log, table or poem as Markdown structure" necessarily means guessing. Guessing wrong is expensive — once a heading or a list is identified, the indentation, run of spaces and careful alignment are gone. So this route does the one thing that cannot be wrong: it adds a fence. For structure, write those few markers yourself, or start from a source that genuinely has structure (Word, HTML, CSV).
这条链路怎么走How the route runs
纯文本 (TXT)plain text (TXT) MarkdownMarkdown
共 1 步,由扩展的路径搜索自动选出,中间产物不落盘。1 step, chosen by the extension's own path search; intermediate results never touch the disk.
会保留什么What carries over
- 每一个字符:内容按原样放进围栏里,缩进、连续空格、行尾空白都不动Every character: the content goes inside the fence untouched — indentation, runs of spaces and trailing whitespace all stay
- 围栏长度会自适应:取文本中最长的三反引号串再 +1,所以内嵌代码片段不会被截断或提前闭合A fence that sizes itself: one longer than the longest backtick run found in the text, so an embedded snippet cannot truncate or close the block early
- 换行结构:这是一次文本包装,不是重排,行号对应关系保持不变The line structure — this is a text wrapper, not a re-typesetting, so line correspondence is preserved
- 文件类型标注为 `text/markdown`,产物是一个 .mdThe file is typed `text/markdown` and delivered as a .md
- 一批最多 200 个文件、单个文件 100 MB 上限,可与其它源格式混批Up to 200 files per batch with a 100 MB per-file ceiling, mixable with other source formats
如实说明的限制What it does not do
- 不生成结构:标题、列表、表格、强调一律不推断,产物整块是代码块(这正是"不改内容"的代价)No structure is manufactured: headings, lists, tables and emphasis are not inferred, and the whole result is one code block — which is the price of not touching the content
- 编码按严格解码链读:UTF-16(看 BOM 或 NUL 分布)→ UTF-8 → GB18030 → GBK,国内 Excel 另存的 GBK 文件读得动;这条链覆盖不了的字节(改了扩展名的压缩二进制,PNG / GIF / ZIP 那一类)报解码失败,而不是悄悄给你一屏乱码——那一屏乱码之后就没法复原了Decoding runs a strict chain — UTF-16 (by BOM or NUL spacing), then UTF-8 → GB18030 → GBK — so a GBK file from a Chinese Excel reads correctly, while bytes no encoding in the chain covers (a compressed binary wearing a .txt name: PNG, GIF, ZIP) report a decode failure rather than quietly producing a screen of mojibake, which could not be undone afterwards
- 围栏之外没有别的加工:如果你想要"看起来像文档"的结构,请走 TXT → HTML 或 TXT → DOCX(它们是另一套取舍)Nothing happens outside the fence: for something that reads like a document, take TXT → HTML or TXT → DOCX, which make different trade-offs
- 反向也有路但不同源:Markdown → TXT 会剥掉标记,而这一条只是包一层,两者不互逆The reverse route is not an inverse: Markdown → TXT strips markers, while this route only wraps — the two are not each other’s undo
实操提示Working with it
- 典型用法是把日志、SQL、CSV 片段、诗歌放进一篇 Markdown 文章里而不被重排——围栏正是为此存在The typical use is putting a log, some SQL, a CSV fragment or a poem into a Markdown article without it being re-typeset — which is exactly what a fence is for
- 想让内容在 Markdown 里"正常显示"而不是当代码,那不需要转换:直接在 .md 里去掉围栏即可,或用 TXT → HTMLIf the content should render normally rather than as code, no conversion is needed: write the .md without a fence, or take TXT → HTML
- 同一份 TXT 还能转 HTML、CSV、JSON 与 DOCX;那几条会解释字段与换行怎么处理,与这条的取舍完全不同The same TXT can go to HTML, CSV, JSON or DOCX; those pages explain how fields and line breaks are handled, and their trade-offs are entirely different
常见问题Questions people actually ask
为什么不帮我把 "# 标题" 认成标题?Why not treat "# Heading" as a heading for me?
因为那行字在普通文本里也可能只是行号、注释或一段配置。认成标题就把"原样"这件事破坏了,而且不可逆——缩进与对齐一旦重排就回不去。宁可让你手动加那一个标记,也不替你猜。Because that line may just as well be a numbering, a comment or a configuration stanza in ordinary text. Reading it as a heading destroys the "verbatim" guarantee irreversibly, since re-flowed indentation does not come back. One manual marker is better than a guess made on your behalf.
我的文本里就有三反引号,会被截断吗?My text already contains triple backticks — will it break the block?
不会。围栏长度是按文本里实际出现的最长反引号串算出来再加一,所以四枚、五枚的反引号串都在围栏之下,块结构稳定。这一点是从"直接写三枚就够"改成实测的原因——那会让内嵌代码把围栏提前闭合。No. The fence is measured against the longest backtick run actually present and made one longer, so runs of four or five sit inside it and the block stays intact. That rule exists because a fixed three-backtick fence would let an embedded snippet close the block early.
老文件是 GBK 编码的,打不开怎么办?My file is GBK and it fails — what now?
这条路径读的是严格解码链,不是宽进严出的猜测:任一编码能严格表示这批字节就按它解,全都不覆盖才报解码失败——猜错的解码是不可逆的。所以国内 Excel 的 GBK / GB18030 文件可以直接转,改了扩展名的压缩二进制(PNG / GIF / ZIP 那一类)会被挡在门口。真遇到报解码失败,先用能指定编码的工具转存成 UTF-8,再拿来转。This route reads through a strict chain, not a permissive guess: whichever of UTF-16, UTF-8, GB18030 and GBK can represent the bytes exactly wins, and only when none can does it report a decode failure — a wrong decoding cannot be undone. So a GBK or GB18030 file from a Chinese Excel converts as-is, while a compressed binary wearing a text extension (a PNG, GIF or ZIP renamed .txt) is stopped at the door. If you do hit the failure, re-save as UTF-8 with a tool that lets you name the encoding, then convert it.
不需要账号,也不需要联网:装好扩展后点图标,在新标签页里打开工作台,文件从磁盘直接选。No account and no network: install the extension, click its icon, and the workbench opens in a new tab reading straight off your disk.
从 Chrome 应用商店安装Install from the Chrome Web Store 安装步骤Install steps GitHub 源码Source on GitHub