convert-to-markdown

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Web-to-Markdown via EzyCopy

通过EzyCopy实现网页转Markdown

Extract clean markdown from any URL using the
ezycopy
CLI.
使用
ezycopy
CLI从任意URL提取干净的markdown内容。

Phase 1: Determine Extraction Mode

阶段1:确定提取模式

Default mode uses fast HTTP fetch. Add
--browser
when the page relies on client-side JavaScript to render its content or when authentication cookies are required — the default fetcher only sees the raw HTML response, not the JS-rendered DOM.
Common
--browser
cases: Twitter/X, single-page applications, paywalled content.
默认模式使用快速HTTP抓取。当页面依赖客户端JavaScript渲染内容,或需要身份验证Cookie时,请添加
--browser
参数——默认抓取工具只能看到原始HTML响应,无法获取JS渲染后的DOM。
常见需使用
--browser
的场景:Twitter/X、单页应用、付费墙内容。

Flags

参数

  • -c
    — copy output to clipboard
  • -o <path>
    — save to file or directory
  • --browser
    — use headless Chrome for JS-rendered or authenticated pages
  • --no-images
    — strip image links
  • -t <duration>
    — timeout (default: 30s)
  • -c
    —— 将输出内容复制到剪贴板
  • -o <路径>
    —— 保存到文件或目录
  • --browser
    —— 使用无头Chrome处理JS渲染或需身份验证的页面
  • --no-images
    —— 移除图片链接
  • -t <时长>
    —— 超时时间(默认:30秒)

Phase 2: Execute

阶段2:执行

Run
ezycopy <URL> [flags]
with the chosen mode.
In
--browser
mode: run as a foreground process and do not redirect stderr with
2>&1
. Chrome outputs diagnostic messages to stderr that should flow naturally rather than polluting stdout capture.
运行
ezycopy <URL> [参数]
并选择相应模式。
--browser
模式下:以前台进程运行,不要使用
2>&1
重定向标准错误输出。Chrome会将诊断信息输出到标准错误流,应让其自然输出,避免污染标准输出的捕获内容。

Phase 3: Handle Failure

阶段3:处理失败

If the output is empty or suspiciously short and
--browser
was not used, retry with
--browser
— the site likely requires JS rendering.
If
ezycopy
is not found, ask the user before installing:
curl -sSL https://raw.githubusercontent.com/gupsammy/EzyCopy/main/install.sh | sh
如果输出为空或异常简短,且未使用
--browser
参数,请重试并添加该参数——该网站可能需要JS渲染。
如果未找到
ezycopy
,请先询问用户再进行安装:
curl -sSL https://raw.githubusercontent.com/gupsammy/EzyCopy/main/install.sh | sh

Phase 4: Deliver

阶段4:交付

Present the extracted markdown to the user. If the user requested a file save, use
-o
. If they requested clipboard, use
-c
. When no explicit destination was given, display the content directly.
将提取的markdown内容呈现给用户。如果用户要求保存为文件,使用
-o
参数;如果要求复制到剪贴板,使用
-c
参数;若未指定明确目标,则直接显示内容。