convert-documents-to-markdown

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Convert documents to Markdown

将文档转换为Markdown

Run the anydoc CLI. It needs Node 20+ and no install:
bash
npx -y @firecrawl/anydoc <file>              # Markdown to stdout
npx -y @firecrawl/anydoc <file> -o out.md    # write to a file
npx -y @firecrawl/anydoc - --format csv < f  # read stdin
Rules:
  1. Supported inputs:
    .doc
    ,
    .docx
    ,
    .docm
    ,
    .odt
    ,
    .rtf
    ,
    .epub
    ,
    .pdf
    ,
    .ppt
    ,
    .pps
    ,
    .pot
    ,
    .pptx
    ,
    .pptm
    ,
    .ppsx
    ,
    .ppsm
    ,
    .odp
    ,
    .xls
    ,
    .xlsx
    ,
    .xlsm
    ,
    .xlsb
    ,
    .ods
    ,
    .csv
    .
  2. The format is detected from the file content. Pass
    --format <name>
    only when detection cannot work: CSV from stdin, or a missing or wrong extension.
  3. Exit codes: 0 success, 1 the document could not be converted, 2 usage error. Failures print one
    anydoc: <message>
    line to stderr. The CLI never prompts.
  4. For a large document, write to a file with
    -o
    and read the parts you need instead of streaming everything into context.
  5. Scanned and image-only PDFs need OCR, which anydoc does not do; they fail as unsupported. The hosted Firecrawl Parse API handles those.
  6. Inside a Node, Python, or Rust codebase, prefer the library over shelling out:
    @firecrawl/anydoc
    on npm,
    firecrawl-anydoc
    on PyPI,
    anydoc
    on crates.io. Each exposes the same
    to_markdown
    /
    toMarkdown
    API.
运行anydoc CLI。它需要Node 20+环境,无需安装:
bash
npx -y @firecrawl/anydoc <file>              # 将Markdown输出到标准输出
npx -y @firecrawl/anydoc <file> -o out.md    # 写入到文件
npx -y @firecrawl/anydoc - --format csv < f  # 从标准输入读取
规则:
  1. 支持的输入格式:
    .doc
    .docx
    .docm
    .odt
    .rtf
    .epub
    .pdf
    .ppt
    .pps
    .pot
    .pptx
    .pptm
    .ppsx
    .ppsm
    .odp
    .xls
    .xlsx
    .xlsm
    .xlsb
    .ods
    .csv
  2. 格式会从文件内容自动检测。仅当检测失效时才需传入
    --format <name>
    参数:比如从标准输入读取CSV,或文件扩展名缺失、错误的情况。
  3. 退出码:0表示成功,1表示文档无法转换,2表示使用错误。失败时会向标准错误输出一行
    anydoc: <message>
    信息。CLI不会进行任何提示。
  4. 对于大型文档,请使用
    -o
    参数写入文件,然后按需读取所需部分,而非将所有内容流式传输到上下文。
  5. 扫描件和纯图片PDF需要OCR处理,anydoc不支持此功能,这类文件会转换失败。托管的Firecrawl Parse API可处理此类文件。
  6. 在Node、Python或Rust代码库中,优先使用对应库而非调用shell命令:npm上的
    @firecrawl/anydoc
    、PyPI上的
    firecrawl-anydoc
    、crates.io上的
    anydoc
    。每个库都提供相同的
    to_markdown
    /
    toMarkdown
    API。