Metadata-Version: 2.4
Name: deepwiki2md
Version: 1.1.1
Summary: A tool to export DeepWiki documentation to Markdown format
Project-URL: Homepage, https://github.com/matsu582/deepwiki2md
Project-URL: Repository, https://github.com/matsu582/deepwiki2md
Project-URL: Issues, https://github.com/matsu582/deepwiki2md/issues
Author: animalmatsuzawa
License: MIT
License-File: LICENSE
Keywords: converter,deepwiki,documentation,export,markdown
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Documentation
Classifier: Topic :: Text Processing :: Markup :: Markdown
Requires-Python: >=3.10
Requires-Dist: beautifulsoup4<5,>=4.12.0
Requires-Dist: selenium<5,>=4.37.0
Requires-Dist: webdriver-manager<5,>=4.0.0
Description-Content-Type: text/markdown

# DeepWiki Export Tool

A tool to retrieve documents from DeepWiki and convert them to Markdown format.

## Supported Sites

- **app.devin.ai/wiki** - Devin Wiki (Login required, language selection available)
- **deepwiki.com** - DeepWiki (No login required, no language selection)

## Features

- Automatic content retrieval using Selenium
- Automatic detection of two site formats
- HTML to Markdown conversion (supports tables, code blocks, lists)
- SVG diagram saving and conversion to Mermaid notation
  - Flowcharts
  - Sequence diagrams
  - State diagrams
  - Class diagrams
- PNG image output (generated by rendering SVG in browser)
- Automatic table of contents generation
- Internal link to relative path conversion
- `<details>` tag (collapsible) support
- Session persistence (app.devin.ai/wiki only, no login required after first time)

### Operation Modes

This tool has two operation modes.

**CUI Mode (Default)**

This mode runs in the background without displaying a browser window. When login is required, you enter your email address and authentication code in the terminal. It is suitable for execution in server environments without GUI (such as SSH connections). However, it does not support OAuth authentication (GitHub/Google, etc.), so only email + authentication code login is available.

**GUI Mode (--no-headless)**

This mode runs with the browser window displayed. It is useful for initial setup and debugging as you can visually confirm login operations. Use this mode if you want to log in with OAuth authentication (GitHub/Google, etc.). When you specify an email address with the `-e` option, the email address is automatically entered on the login page and the Continue button is also automatically clicked.

## Supported Platforms

- Windows
- macOS
- Linux

## Requirements

- Python 3.10 or higher
- Chrome/Chromium browser
- uv (recommended) or pip

## Installation (From PyPI - Recommended)

```bash
# Install with pip
pip install deepwiki2md

# Or install with uv
uv tool install deepwiki2md
```

After installation, the `deepwiki2md` command is available:

```bash
deepwiki2md <DeepWiki URL>

# Or run as a Python module
python -m deepwiki2md <DeepWiki URL>
```

## Installation (From Source)

```bash
git clone https://github.com/matsu582/deepwiki2md.git
cd deepwiki2md
```

### Using uv (Recommended)

If uv is not installed, use the following command to install it.

**Windows (PowerShell)**:
```powershell
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
```

**macOS / Linux**:
```bash
curl -LsSf https://astral.sh/uv/install.sh | sh
```

```bash
# Dependencies are resolved and installed automatically
uv run deepwiki2md <DeepWiki URL>
```

### Using pip

```bash
# Create virtual environment (recommended)
python -m venv .venv

# Activate virtual environment
# Windows
.venv\Scripts\activate
# macOS / Linux
source .venv/bin/activate

# Install from source
pip install -e .

# Run
deepwiki2md <DeepWiki URL>
```

### Without Installation (dependencies only)

You can run the tool directly without installing the package itself:

```bash
# Install dependencies only
pip install selenium beautifulsoup4 webdriver-manager

# Run as a Python module from the repository root
python -m deepwiki2md <DeepWiki URL>
```

## Usage

### Basic Usage

```bash
# Installed from PyPI
deepwiki2md <DeepWiki URL>

# Using uv from cloned source (no install needed)
uv run deepwiki2md <DeepWiki URL>

# As a Python module (from cloned source root)
python -m deepwiki2md <DeepWiki URL>
```

### Options

| Option                 | Description                              | Default                 |
| ---------------------- | ---------------------------------------- | ----------------------- |
| `-o`, `--output`       | Output directory                         | `output`                |
| `-l`, `--lang`         | Language selection                       | `japanese`              |
| `-d`, `--diagram_type` | Diagram output type                      | `mermaid,svg`           |
| `-e`, `--email`        | Email address for login                  | None (prompt displayed) |
| `--no-headless`        | Run in GUI mode (display browser window) | `false`                 |

### Diagram Output Type (--diagram_type)

- `png`: PNG images only
- `svg`: SVG images only
- `mermaid`: Mermaid notation only
- Multiple formats (comma-separated): `png,mermaid,svg`
- First format is displayed directly, others are in `<details>` collapsible sections

### Examples

```bash
# app.devin.ai/wiki (login required)
deepwiki2md https://app.devin.ai/wiki/owner/repo

# deepwiki.com (no login required)
deepwiki2md https://deepwiki.com/owner/repo

# Specify output directory
deepwiki2md https://deepwiki.com/owner/repo -o ./my_docs

# Retrieve in English (app.devin.ai/wiki only)
deepwiki2md https://app.devin.ai/wiki/owner/repo -l english

# PNG images only
deepwiki2md https://deepwiki.com/owner/repo -d png

# PNG first, Mermaid and SVG in collapsible sections
deepwiki2md https://deepwiki.com/owner/repo -d png,mermaid,svg

# Specify email address
deepwiki2md https://app.devin.ai/wiki/owner/repo -e user@example.com

# Run in GUI mode (display browser window)
deepwiki2md https://app.devin.ai/wiki/owner/repo --no-headless
```

## Execution Flow

### For app.devin.ai/wiki

1. The tool launches a Chrome browser
2. If a login page is displayed, please log in manually
3. After logging in, press Enter in the terminal
4. The specified language is automatically selected on the language selection screen
5. Language selection defaults to **Japanese**. The Japanese DeepWiki must already be created.
6. The tool automatically retrieves all sections and converts them to Markdown

### For deepwiki.com

1. The tool launches a Chrome browser
2. No login required - the page loads automatically
3. The tool automatically retrieves all sections and converts them to Markdown

### Default Behavior (Headless Mode)

1. The tool launches a headless browser (no display)
2. If a login page is detected, you will be prompted to enter your email address via CUI
   - If you specify an email address with the `-e` option, the input prompt will be skipped
3. After entering your email, an authentication code will be sent to your email
4. If an authentication code page is detected, you will be prompted to enter the code via CUI
5. After successful login, the tool automatically retrieves all sections and converts them to Markdown

**Note**: Headless mode only supports email + authentication code method. If you want to log in with OAuth (GitHub/Google, etc.), use the `--no-headless` option to run in GUI mode.

## Output Files

```
output_directory/
├── 00_table_of_contents.md  # Table of contents
├── 01_Overview.md            # Markdown for each section
├── 02_System_Architecture.md
├── ...
└── images/                   # SVG diagrams
    ├── 01_Overview_01.svg
    ├── 01_Overview_02.svg
    └── ...
```

## File Structure

```
deepwiki2md/
├── deepwiki2md/
│   ├── __init__.py           # Package initialization / version info
│   ├── __main__.py           # python -m deepwiki2md support
│   ├── cli.py                # Main script (entry point)
│   ├── extract_subgraphs.py  # SVG to Mermaid conversion
│   ├── html_to_markdown.py   # HTML to Markdown conversion
│   └── locale/               # i18n translation files
│       └── ja/LC_MESSAGES/
├── pyproject.toml            # Project configuration
├── README.md
├── README_JP.md
└── LICENSE
```

## Troubleshooting

### ChromeDriver Error

webdriver-manager automatically downloads ChromeDriver, but
if problems occur, install it manually:

- Windows: https://chromedriver.chromium.org/downloads
- macOS: `brew install chromedriver`
- Linux: `apt install chromium-chromedriver`

### Reset Login Session

Session information is saved in the following location:

- Windows: `%LOCALAPPDATA%\DeepWiki2Md\chrome_profile`
- macOS: `~/Library/Application Support/DeepWiki2Md/chrome_profile`
- Linux: `~/.config/deepwiki2md/chrome_profile`

If problems occur, delete this directory.

## Supported DeepWiki Version

This tool is compatible with the DeepWiki site structure as of the following dates.

| Site | Verified | Key Structures |
| --- | --- | --- |
| deepwiki.com | 2026-06-23 | Content: `div[class*="prose-custom"]`, Sidebar: link-based |
| app.devin.ai/wiki | 2026-06-23 | Content: `div.prose-main`, Sidebar: `a[href*="/page/"]` (/page/X.Y format), Language: `menuitemradio` inside "..." menu, URL: `/org/{org}/wiki/{owner}/{repo}/page/{num}` |

DeepWiki's site structure may change without notice. If the tool stops working, a structural change is likely the cause.

## Notes

- app.devin.ai/wiki requires login on first run
- deepwiki.com does not require login
- Exporting may take time if there are many pages
- Timeouts may occur depending on network conditions
- Language selection option (`-l`) is ignored for deepwiki.com
