Skip to content

kkAyataka/mkdocs-decodiff-plugin

Repository files navigation

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

How to Use

Install

pip install mkdocs-decodiff-plugin

mkdocs.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

Collect change links in this file as a list.

# 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.

# 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

About

Decorate Markdown diff lines for better readability. CLI and MkDocs plugin.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors