Skip to content

BDiff/BDiff-Visualization-Exporter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

21 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

BDiff Visualization Exporter

A tool to export BDiff's visualized diff results to local HTML files, enabling intuitive visualization of block-level code differences.

๐Ÿ”† Overview

This tool generates interactive HTML pages that visualize the differences between two code files using the BDiff algorithm. It converts the block-aware and accurate edit script produced by BDiff into a user-friendly web interface, making it easier to understand code changes at the block level.

1. ๐ŸŽป Main Features

Generates standalone HTML files with embedded diff data. The page has the same feature as the BDiff online tool:

  • Language-independent: BDiff is a text-based differencing algorithm and can thus be applied to code written in any programming language.
  • Comprehensive Difference Identification: It can identify line deletions, line additions, line updates, line splits, line merges, block copies (including line updates), and block moves (including line updates).
  • Generate Edit Scripts: Produces edit scripts based on the identified differences.
  • Display Updated Difference Substrings: Shows the specific substrings that have been updated.
  • Edit Action Localization: Helps pinpoint the edit actions within the script.
  • View Before-and-After Mapped Lines/Blocks: Allows users to view the mapped lines or blocks before and after the changes.
  • Set Difference Display Modes: Offers alignment mode and compact mode for displaying differences.
  • Language Settings: Supports Chinese and English.
  • Theme Settings: Switch between light and dark themes for comfortable viewing.
  • Difference Option Settings: Customize comparison parameters for precise results.
  • Programming Language Highlighting: Syntax-aware highlighting for major programming languages.

2. ๐Ÿ”จ Dependencies

  • beautifulsoup4
pip install beautifulsoup4

3. ๐ŸŽฎ Usage

from bdiff_visualization_exporter import run

# Compare src_file.py and dest_file.py
# Output will be saved to the html directory
run('src_file.py', 'dest_file.py')

4. ๐Ÿ“ƒ License

This software is licensed under Mulan Public License๏ผŒVersion 2 (Mulan PubL v2).

Copyright (c) [2025] [Lu Yao, Song Wansheng]
BDiff is licensed under Mulan PubL v2.
You can use this software according to the terms and conditions of the Mulan PubL v2.
You may obtain a copy of Mulan PubL v2 at:
         http://openworks.mulanos.cn/#/licenses/MulanPubL-v2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PubL v2 for more details.

About

Export BDiff's visualized differencing results to local page files

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published