Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/publish-npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Publish Package to npmjs

on:
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-24.04
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v3
with:
version: 9.15.9
- uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
- run: |
pnpm i
cd packages/pdf2md && pnpm build && pnpm publish
cd ../mcp && pnpm build && pnpm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
12 changes: 5 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/node_modules
/test/samples
/test/output
/test/results
/test/imahes
/test/tt.js
/test/mm.js
**/node_modules
**/dist
.vscode/mcp.json
samples
packages/mcp/output
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"printWidth": 160,
"singleQuote": true,
"endOfLine": "lf"
}
22 changes: 10 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# PDF2MD Node.js

<p align="center">
<img src="https://img.shields.io/badge/node-%3E%3D%2016.0.0-brightgreen" alt="Node.js Version">
<img src="https://img.shields.io/badge/node-%3E%3D%2020.0.0-brightgreen" alt="Node.js Version">
<img src="https://img.shields.io/badge/license-MIT-blue" alt="License">
</p>

Expand All @@ -20,25 +20,23 @@ A powerful Node.js tool for converting PDF documents to Markdown format using ad
## 🚀 Installation

```bash
# Clone the repository
git clone https://github.com/yourusername/pdf2md.git
cd pdf2md/pdf2md-node

# Install dependencies
npm install
pnpm add pdf2md-js
# or
npm add pdf2md-js
```

## 📋 Requirements

- Node.js 16.0.0 or higher
- Node.js 20.0.0 or higher
- API key for at least one of the supported vision models

## 🔧 Usage

### Basic Usage

```javascript
import { parsePdf } from './src/index.js';
import { parsePdf } from 'pdf2md-js';

const result = await parsePdf('path/to/your.pdf', {
apiKey: 'your-api-key',
Expand Down Expand Up @@ -107,19 +105,19 @@ The project includes several test scripts to verify functionality:

```bash
# Test the full PDF to Markdown conversion process
node test/testFullProcess.js
pnpm vite-node test/testFullProcess.js

# Test only the PDF to image conversion
node test/testFullPageImages.js
pnpm vite-node test/testFullPageImages.js

# Test specific vision models
node test/testModel.js
pnpm vite-node test/testModel.js
```

## 📁 Project Structure

```
pdf2md-node/
pdf2md-js/
├── src/
│ ├── index.js # Main entry point
│ ├── pdfParser.js # PDF parsing module
Expand Down
24 changes: 11 additions & 13 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# PDF2MD Node.js

<p align="center">
<img src="https://img.shields.io/badge/node-%3E%3D%2016.0.0-brightgreen" alt="Node.js 版本">
<img src="https://img.shields.io/badge/node-%3E%3D%2020.0.0-brightgreen" alt="Node.js 版本">
<img src="https://img.shields.io/badge/license-MIT-blue" alt="许可证">
</p>

Expand All @@ -18,25 +18,23 @@
## 🚀 安装

```bash
# 克隆仓库
git clone https://github.com/yourusername/pdf2md.git
cd pdf2md/pdf2md-node

# 安装依赖
npm install
# Install dependencies
pnpm add pdf2md-js
# or
npm add pdf2md-js
```

## 📋 系统要求

- Node.js 16.0.0 或更高版本
- Node.js 20.0.0 或更高版本
- 至少一个支持的视觉模型的API密钥

## 🔧 使用方法

### 基本用法

```javascript
import { parsePdf } from './src/index.js';
import { parsePdf } from 'pdf2md-js';

const result = await parsePdf('path/to/your.pdf', {
apiKey: 'your-api-key',
Expand Down Expand Up @@ -106,19 +104,19 @@ const result = await parsePdf('path/to/your.pdf', options);

```bash
# 测试完整的PDF到Markdown转换流程
node test/testFullProcess.js
pnpm vite-node test/testFullProcess.js

# 仅测试PDF到图像的转换
node test/testFullPageImages.js
pnpm vite-node test/testFullPageImages.js

# 测试特定视觉模型
node test/testModel.js
pnpm vite-node test/testModel.js
```

## 📁 项目结构

```
pdf2md-node/
pdf2md-js/
├── src/
│ ├── index.js # 主入口点
│ ├── pdfParser.js # PDF解析模块
Expand Down
Loading