# py-xmind16

A Python library for creating and editing XMind 16 files.

## Features

- Create XMind 16 compatible files
- Read and modify existing XMind files
- Support for topics, subtopics, notes, labels, and markers
- Multiple sheets per workbook
- Simple and intuitive API

## Installation

```bash
pip install py-xmind16
```

## Quick Start

### Create a Simple Mind Map

```python
from py_xmind16 import Workbook

# Create a new workbook
workbook = Workbook()

# Create a sheet
sheet = workbook.create_sheet("My Mind Map")

# Get the root topic and add content
root = sheet.get_root_topic()
root.title = "Project Ideas"

# Add subtopics
tech = root.add_subtopic("Technology")
tech.add_subtopic("AI/ML")
tech.add_subtopic("Web Development")

# Save the file
workbook.save("my_ideas.xmind")
```

### Load and Edit an Existing File

```python
from py_xmind16 import Workbook

# Load an existing file
workbook = Workbook.load("existing.xmind")

# Get the first sheet
sheet = workbook.get_sheet(0)
root = sheet.root_topic

# Modify content
root.title = "Updated Title"
root.add_subtopic("New Topic")

# Save changes
workbook.save("updated.xmind")
```

## API Reference

### Workbook

The main container for XMind content.

```python
workbook = Workbook()
sheet = workbook.create_sheet("Sheet Title")
workbook.save("output.xmind")
```

### Sheet

Represents a single mind map canvas.

```python
sheet = workbook.create_sheet("My Sheet")
root = sheet.get_root_topic()
```

### Topic

Represents a node in the mind map.

```python
topic = root.add_subtopic("Topic Title")
topic.notes = "Detailed notes"
topic.add_label("important")
topic.add_marker("priority-1")
```

## Examples

See the `examples/` directory for more usage examples:

- `create_simple.py` - Create a basic mind map
- `create_testcases.py` - Create a test case structure
- `edit_existing.py` - Edit an existing XMind file

## Development

### Setup

```bash
git clone https://github.com/example/py-xmind16.git
cd py-xmind16
pip install -e ".[dev]"
```

### Run Tests

```bash
pytest
```

### Run with Coverage

```bash
pytest --cov=py_xmind16
```

## License

MIT License - see LICENSE file for details.
