WhatsUpDoc 是一款强大的命令行工具,借助模型上下文协议(MCP),它能够从任意网站抓取开发者文档,并将其本地存储。这极大地方便了开发者获取和管理所需的文档资源。
使用 WhatsUpDoc 可以轻松地从网站获取文档并保存为 Markdown 格式。以下是基本的使用步骤:
downmarked fetch
运行上述命令后,你将被提示输入输出位置,之后文档会以 Markdown 格式保存。
# 全局安装
npm install -g downmarked
# 或使用npx
npx downmarked fetch https://reactjs.org/docs/getting-started.html
downmarked fetch
此命令会提示你输入输出位置,并将文档保存为 Markdown 格式。
# 带有特定选项获取文档
downmarked fetch https://reactjs.org/docs/getting-started.html \
-o ~/Documents/react-docs.md \
-s "main" \
-r \
-d 2 \
--split
| 属性 | 详情 |
|---|---|
-o, --output
|
输出路径(绝对或相对) |
-s, --selector <选择器> |
CSS 选择器,用于指定特定内容 |
-r, --recursive |
递归获取链接的文档页面 |
-d, --max-depth <数字> |
递归获取的最大深度(默认:3) |
--split |
根据标题将文档拆分到单独文件中 |
# 将React文档保存到特定位置
downmarked fetch https://reactjs.org/docs/getting-started.html -o ~/Documents/react-docs.md
# 只获取主要内容区域
downmarked fetch https://reactjs.org/docs/getting-started.html -s "main"
# 递归获取链接页面,深度最多2层
downmarked fetch https://reactjs.org/docs/getting-started.html -r -d 2
# 保存Python文档
downmarked fetch https://docs.python.org/3/tutorial/index.html -o python-tutorial.md
WhatsUpDoc 使用模型上下文协议(MCP)实现标准化通信。其工作流程如下:
欢迎大家为 WhatsUpDoc 项目贡献力量!如果你有新的想法或改进建议,请按照以下步骤提交 Pull Request:
git checkout -b feature/amazing-feature)。git commit -m '添加一些 amazing 功能')。git push origin feature/amazing-feature)。本项目使用 MIT 许可证,详情请参阅 LICENSE 文件。
感谢以下项目对 WhatsUpDoc 的贡献: