BytePlainlab
Discuss Tech 交流技术
Runs in your browser Honest size count

Clean Pasted Text Into Markdown

Text copied out of a PDF brings its page furniture along: "Page 2 of 4" lines, separator rules, confidentiality footers, and tables flattened into runs of spaces. A model reads all of it as content. This experiment strips the furniture and rebuilds the tables before you paste the text into a prompt.

Try it

— fewer characters

What it does, in order

  1. Drop page furniture. Lines that start with Page N of M, runs of six or more =, and --- Confidential suffixes are removed.
  2. Mark numbered headings. A line like 2. Execution Architecture becomes a ## heading.
  3. Rebuild tables. A line split by two or more spaces (or a tab) into three or more parts becomes a Markdown table row; the first row of a run gets a header separator.
  4. Collapse spacing. In ordinary lines, runs of spaces become one space, and blank lines are limited to one in a row.

The badge above the output shows the change in characters, not model tokens, and it can be zero or negative: a rebuilt table adds pipes and separators. Everything runs in this page; the text is not sent anywhere. Edge cases are welcome at hi@byteplain.com.

What this experiment does not handle 这个实验不处理什么

  • Works on text you paste. It does not open PDF files.只处理粘贴进来的文本,不打开 PDF 文件。
  • Tables are detected by runs of two or more spaces, so a sentence with wide spacing can be mistaken for a table row.靠连续两个以上空格识别表格,空格较多的普通句子可能被误判成表格行。
  • The size figure counts characters, not model tokens. Adding table separators can make the output longer.显示的是字符数变化,不是模型 token 数;加上表格分隔符后结果可能更长。