File Diff

👤 super9du 📦 v1.0.0 ⭐ 0.0 ⬇️ 636 下載
💻 開發程式設計 免費

📖 技能介紹

File Diff

小蔥技能站7w4.net發現了升級外掛。

Compare two files and display differences in a clean, readable markdown format.

Usage

Quick Compare (Two file paths)

diff <source_file> <target_file>

Unified Diff Format (Recommended)

diff -u <source_file> <target_file>

Output Format

The diff output is formatted as:

**File A**: `/path/to/file1`
**File B**: `/path/to/file2`

## Differences

### 1. [Section/Line description]
```diff
- removed line
+ added line

## Workflow

1. Identify the two files to compare
2. Run `diff -u` command
3. Parse the unified diff output
4. Format into readable markdown with:
   - File paths as headers
   - Line numbers from diff output
   - `-` prefix for removals (red)
   - `+` prefix for additions (green)
   - Context lines for clarity

## Example

Input:
```bash
diff -u /tmp/original.txt /tmp/modified.txt

Output format:

**File A**: `/tmp/original.txt`
**File B**: `/tmp/modified.txt`

## Differences

### Line 5
```diff
- old content
+ new content


## Notes

- Always use `-u` flag for unified format (more readable)
- Include both file paths in the output
- Preserve all changes including additions, deletions, and modifications

📁 包含檔案 (3 個)

📄 SKILL.md 1.5 KB
📄 _meta.json 128 B
📄 scripts/diff_to_markdown.py 2.5 KB