Files
md-to-docx/README.md
Mikan bba1e8ca7e [AI]
MVP готов
2025-12-08 17:48:35 +03:00

101 lines
2.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# md-to-docx
Конвертер Markdown в Word (.docx) с поддержкой стилей, тем и плагинов.
## Установка
```bash
pip install -r requirements.txt
```
## Использование
### Структура входных данных:
```
inputs/
├── my_doc/
│ ├── document.md
│ └── images/
│ ├── img1.png
│ └── img2.jpg
```
### Простой запуск:
```bash
python -m src --input inputs --output outputs
```
### С использованием темы:
```bash
python -m src --input inputs --output outputs --theme academic
```
### С шаблоном .dotx:
```bash
python -m src --input inputs --output outputs --template template.dotx
```
### С плагинами:
```bash
python -m src --input inputs --output outputs --plugins my_plugins/
```
### Дополнительные опции:
- `--verbose` / `-v` — подробный лог
- `--quiet` / `-q` — без логов
- `--dry-run` — показать, что будет сделано
- `--style path/to/style.yaml` — использовать свой стиль
## Поддерживаемые элементы
- Заголовки `#`, `##`, `###`
- Параграфы
- Списки: `-`, `1.`
- **Жирный**, *курсив*, [ссылки](https://example.com)
- Изображения: `![alt](images/file.png)`
- Таблицы
- `<br>` внутри таблиц и параграфов
## Стили
Стили задаются в `resources/style_config.yaml` или через `--theme`.
Пример:
```yaml
styles:
Heading 1:
font:
name: "Times New Roman"
size: 16
bold: true
```
## Плагины
Можно создать свой обработчик:
```python
# plugins/my_block.py
from src.handlers import register_handler
@register_handler("my_block")
def handle_my_block(node, doc, images_dir, style_reg):
# ваш код
pass
```
И использовать: `--plugins plugins/`
## Docker
```bash
docker build -t md2docx .
docker run -v ./inputs:/app/inputs -v ./outputs:/app/outputs md2docx --input inputs --output outputs
```