# htmldiff **Repository Path**: mirrors/htmldiff ## Basic Information - **Project Name**: htmldiff - **Description**: Calculate the difference between two HTML snippets - **Primary Language**: PHP - **License**: Not specified - **Default Branch**: master - **Homepage**: https://www.oschina.net/p/htmldiff - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2017-04-03 - **Last Updated**: 2025-10-18 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README htmldiff is a PHP library that displays the difference between two HTML snippets. It is taken from the [MediaWiki Visual Diff module](http://www.mediawiki.org/wiki/Visual_Diff) and has been modified to be usable outside of MediaWiki. Usage ===== ```php require("htmldiff/html_diff.php"); $html1 = "

This is an example text with a bold part.

"; $html2 = "

This is a changed example text without a bold part.

"; echo html_diff($html1, $html2); ``` Output: ```html

This is an a changed example text with without a bold part.

``` License ======= This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. or see http://www.gnu.org/ Sources ======= These are the original MediaWiki source files that this library is based on: [HTMLDiff.php](http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/includes/diff/HTMLDiff.php?view=markup&pathrev=58266), [Diff.php](http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/includes/diff/Diff.php?view=markup&pathrev=58266), [Nodes.php](http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/includes/diff/Nodes.php?view=markup&pathrev=58266), [Sanitizer.php](http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/includes/Sanitizer.php?view=markup&pathrev=58267), [Xml.php](http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/includes/Xml.php?view=markup&pathrev=58267)