Diffs arbitrary HTML inline.
Project description
htmldiff2
htmldiff2 is a library that uses difflib, genshi and html5lib to diff arbitrary fragments of HTML inline. htmldiff2 is a friendly fork of Armin Ronacher's htmldiff which needed to be upgraded for the diffengine project. See this issue for context.
>>> from htmldiff2 import render_html_diff
>>> render_html_diff('Foo <b>bar</b> baz', 'Foo <i>bar</i> baz')
u'<div class="diff">Foo <i class="tagdiff_replaced">bar</i> baz</div>'
>>> render_html_diff('Foo bar baz', 'Foo baz')
u'<div class="diff">Foo <del>bar</del> baz</div>'
>>> render_html_diff('Foo baz', 'Foo blah baz')
u'<div class="diff">Foo <ins>blah</ins> baz</div>'
Develop
python -mvenv .venv
source .venv/bin/activate
python -m pip install -e .
python test.py
Publish
python -m pip install setuptools build twine
python -m build
python -m twine upload dist/*
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
htmldiff2-0.2.2.tar.gz
(5.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file htmldiff2-0.2.2.tar.gz.
File metadata
- Download URL: htmldiff2-0.2.2.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0539673b590ef0976a9025c5e05468093bc37aabd1dda16a8ccbbce52f97870f
|
|
| MD5 |
f4bba09bfe66607d52b467a15455b27a
|
|
| BLAKE2b-256 |
7b954925479e76e60539cf985852423898d1dad9f151923ef4e0b6d86036a21d
|
File details
Details for the file htmldiff2-0.2.2-py3-none-any.whl.
File metadata
- Download URL: htmldiff2-0.2.2-py3-none-any.whl
- Upload date:
- Size: 6.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02bdda8c151ea51076f75ed0717d2574ffd6fc7cc9c5c546dabbb3135daa62f6
|
|
| MD5 |
44ae404c8a6c8eb1dd061debb1967afe
|
|
| BLAKE2b-256 |
1cce7f66da27ad9caec7e4d5b482286d3bc103b49cab9f299f0139586f2be00a
|