Metadata-Version: 2.4
Name: mkdocs-decodiff-plugin
Version: 0.0.7
Summary: MkDocs plugin to decorate git diff lines
Author-email: kkAyataka <kk.ayataka@gmail.com>
License-Expression: MIT
Project-URL: Homepage, https://github.com/kkAyataka/mkdocs-decodiff-plugin
Project-URL: Issues, https://github.com/kkAyataka/mkdocs-decodiff-plugin
Classifier: Development Status :: 4 - Beta
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: dev
Requires-Dist: build; extra == "dev"
Requires-Dist: twine; extra == "dev"
Requires-Dist: wheel; extra == "dev"
Requires-Dist: pytest; extra == "dev"
Requires-Dist: pytest-cov; extra == "dev"
Requires-Dist: ruff; extra == "dev"
Requires-Dist: watchdog; extra == "dev"
Requires-Dist: mkdocs; extra == "dev"
Dynamic: license-file

# mkdocs-decodiff-plugin

## Overview

This is an MkDocs plugin for decorating Git diff lines.

This program inserts HTML tags into Markdown files to decorate diff lines using `git diff` output.

![decoration-image](https://raw.githubusercontent.com/kkAyataka/mkdocs-decodiff-plugin/refs/heads/main/docs/_res/decoration-image.png)

## How to Use

### Install

```shell
pip install mkdocs-decodiff-plugin
```

### mkdocs.yml

```yml
plugins:
 - decodiff:
      base: main
      dir: docs
      change_list_file: docs/changes.md
```

* **base**:

  Reference for `git diff`. You can specify a hash, tag name, or branch name.

  ```
  git diff {base}
  ```
* **dir**:

  Target directory.

  ```
  git diff -- {dir}
  ```

* **change_list_file**:
  
  [Changes list file](#change_list_file)


## change_list_file

Collect change links in this file as a list.

```markdown
# Changes

<!-- decodiff: Written by decodiff from here -->
## [index.md](index.md)

* [new section](index.md#decodiff-anchor-1)

<!-- decodiff: end -->
```

The part between the `<!-- decodiff: -->` tags is generated by decodiff, but the rest can be modified.

```markdown
# You can change

You can change

<!-- decodiff: Written by decodiff from here -->

This section is overwritten by decodiff

<!-- decodiff: end -->

You can change
```

## NOT supported

* Changes in a code block
* Changes in a table
* Changes in HTML blocks
* Character unit changes

## Behavior

* Retrieve diff data using `git diff`
* Add an HTML tag to each diff line. For example:
    * `<span id="decodiff-hunk-1" class="decodiff">text</span>`
    * Preserve leading markup, such as headings (`#`) and bullet points (`*`)
* Create a diff list file containing a list of links

## LICENSE

[MIT License](../LICENSE)
