I'm afraid that the visual differ isn't helpfully set up for this. Its approach is to fetch the parsoid HTML for the revisions to compare, and then generate the comparison output client-side. It's not terribly reusable outside of the VisualEditor context -- all of the describing of changes that it does leans heavily on interrogating VisualEditor's data model for information about the things that changed.

The best I can say about this for your purposes is that using the parsoid HTML would relieve you of having to parse wikitext to work out whether the contents of a math tag were what changed. 🤷🏻

If you do want to dig into this further, check out: https://doc.wikimedia.org/VisualEditor/master/js/source/ve.init.mw.DiffLoader.html

~David

On Mon, Jul 5, 2021 at 11:48 AM Physikerwelt <wiki@physikerwelt.de> wrote:
Hi all,

thank you for your feedback.

@Roy this is a good point, I honestly did not think about it before.
However, in the back of my mind, I remembered this problem had been
solved before. There is a beta feature called visual diffs.

If you enable this feature and navigate to
https://en.wikipedia.org/w/index.php?title=User:RoySmith/sandbox&type=revision&diff=1031413484&oldid=1031413445&diffmode=visual

you see the text "math formula changed" this is exactly what I was
looking for. Unfortunately, I was not yet able to figure out if there
is an API to get the visual diffs. I had expected it to be in
RESTbase, but nothing there.

If I can get to that API the problem would be simple enough to start
with the implementation.

All the best
Moritz

On Thu, Jul 1, 2021 at 3:39 PM Amir Sarabadani <ladsgroup@gmail.com> wrote:
>
> Note on ORES as one of its maintainers:
> ORES doesn't use recent changes for getting content and scoring edits. It hits the API.
>
> HTH
>
> On Thu, Jul 1, 2021 at 3:18 PM Robin Hood <RobinHood70@live.ca> wrote:
>>
>> I’m no expert, but I believe the only way to get a diff via the API is through https://www.mediawiki.org/wiki/API:Compare. I haven’t worked with it to any great degree, though, so I’m afraid I can’t help beyond pointing you in that direction.
>>
>>
>>
>> From: Physikerwelt <wiki@physikerwelt.de>
>> Sent: July 1, 2021 8:17 AM
>> To: Wikimedia developers <wikitech-l@lists.wikimedia.org>
>> Cc: andre.greiner-petter <andre.greiner-petter@zbmath.org>; Aaron Halfaker <ahalfaker@wikimedia.org>
>> Subject: [Wikitech-l] Stream of recent changes diffs
>>
>>
>>
>> Dear all,
>>
>>
>>
>> we have developed a tool that is (in some cases) capable of checking if formulae in <math/>-tags in the context of a wikitext fragment are likely to be correct or not. We would like to test the tool on the recent changes. From
>>
>>
>>
>> https://www.mediawiki.org/wiki/API:Recent_changes_stream
>>
>>
>>
>> we can get the stream of recent changes. However, I did not find a way to get the diff (either in HTML or Wikitext) to figure out how the content was changed. The only option I see is to request the revision text manually additionally. This would be a few unnecessary requests since most of the changes do not change <math/>-tags. I assume that others, i.e., ORES
>>
>>
>>
>> https://www.mediawiki.org/wiki/ORES,
>>
>>
>>
>> compute the diffs anyhow and wonder if there is an easier way to get the diffs from the recent changes stream without additional requests.
>>
>>
>>
>> All the best
>>
>> Physikerwelt (Moritz Schubotz)
>>
>>
>>
>>
>>
>> _______________________________________________
>> Wikitech-l mailing list -- wikitech-l@lists.wikimedia.org
>> To unsubscribe send an email to wikitech-l-leave@lists.wikimedia.org
>> https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/
>
>
>
> --
> Amir (he/him)
>
> _______________________________________________
> Wikitech-l mailing list -- wikitech-l@lists.wikimedia.org
> To unsubscribe send an email to wikitech-l-leave@lists.wikimedia.org
> https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/
_______________________________________________
Wikitech-l mailing list -- wikitech-l@lists.wikimedia.org
To unsubscribe send an email to wikitech-l-leave@lists.wikimedia.org
https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/