Jump to content

WMDE Technical Wishes/Show text changes when moving text chunks

From Meta, a Wikimedia project coordination wiki

Finding moved paragraphs and the changes inside them


Showing text changes within a text chunk when moving that chunk was wish #2 of the German-speaking Technical Wishes Survey in 2015.

Currently, it is very hard to find a text change within a moved text chunk in the diff view. This wish is about making text changes within a moved text chunk visible in the wikitext.



Main Phabricator ticket: T139603

Diff code is highly complicated and extremely challenging to work on. It needs to be handled differently than other code, as diff-code is very performance-intensive. To be used in the Wikimedia projects, changes to the diff code have to be written in C++.

The WMDE team has been working on an improved diff code and view:


  • When moving a paragraph/text chunk from one column to the other, the column on the opposite site of the moved parapgraph stays empty (as it is now). An arrow on the side of the old position of the moved paragraph indicates that this paragraph got moved. By clicking on it, you will jump to the new position of the paragraph.
  • Changes within the moved paragraph will be highlighted.

Improving Wikidiff2


The work that has been done goes further than the original wish, and the team generally improved the algorithm of wikidiff2 (the commonly used diff algorithm in Mediawiki). The changes that have been made don’t affect the way most of the diffs are displayed: Most diffs are already ok, therefore only roughly 20% of all diffs change because of the made changes to wikidiff2. The other 80% look the same - before and after the changes.

The following list shows randomly selected pages with and without the moved-paragraph patch and related changes to wikidiff2:

In the list, only 76 out of 362 compared diff outputs differ (20.99%). The “False” or “True” in the first column indicates if something has changed or not caused by the made changes to wikidiff2. The second column indicates if a paragraph got moved or not.

Fixed bug in diff view


A bug in Wikidiff2 was found while working on this wish: Sometimes two paragraphs which are not related at all were considered a changed paragraph. This bug was fixed by the end of October 2017.

Overview of the technical work

  • An overview of the technical work that has been done can be found here.



Desktop version


Deployment roadmap:

  • December 6, 2017: mediawiki.org and dewiki Done
  • May 30, 2018: Deployment to most wikis Done
  • August 23, 2018: Deployment to Thai, Chinese and Japanese wikis Done

Feedback is always welcome on the talk page.

Mobile version

  • The backend development work for the mobile version is done, and the design work on the user interface (handled by the WMF's Reading Web team) has been completed. The change has been deployed on August 23rd 2018. Done

Related project: Visual Diffs

VisualEditor/Visual Diff showing a paragraph being moved and changed

For the use within Visual Editor, the WMF is currently working on visual diffs. The Visual Diff works only with the rendered HTML and does not handle the raw wikitext. It shows the changes in a single column and changes are highlighted in different colours, deletions are crossed out (see screenshots).

More information: mw:VisualEditor/Diffs


  • In VisualEditor the new functionality is enabled by default
  • On diff pages the new functionality can be tested by adding &visualdiff to the url of a diff (early version!).

See also