This page is part of a static HTML representation of the TiddlyWiki at https://tiddlywiki.com/

makepatches Operator

24th July 2026 at 8:15am
purposereturns a set of patches that transform the input to a given string
inputa selection of titles
suffixT:F=optional suffixes specifying the diff mode and output format
parameterS=a string of characters
outputa set of patch instructions per input title to be used by the applypatches Operator to transform the input title(s) into the string S, or a structured JSON array representing the differences if the json suffix is used

Learn more about how to use Filters

Introduced in v5.2.6

The makepatches operator uses up to two suffixes:

  • T (diff mode): lines to operate in line mode, words to operate in word mode. If omitted (default), the algorithm operates in character mode.
  • F (output format): New in v5.5.0 json to output a structured JSON array of differences instead of a standard patch string. To use the JSON output with the default character mode, skip the first suffix with a double colon (e.g., makepatches::json).

The difference algorithm operates in character mode by default. This produces the most detailed diff possible. In words mode, each word in the input text is transformed into a meta-character, upon which the algorithm then operates. In the default character mode, the filter would find two patches between "ActionWidget" and "Action-Widgets" (the hyphen and the plural s), while in words mode, the whole word is found to be changed. In lines mode, the meta-character is formed from the whole line, delimited by newline characters, and is found to be changed independent of the number of changes within the line.

The different modes influence the result when the patches are applied to texts other than the original, as well as the runtime.

Tip
The calculation in words mode is roughly 10 times faster than the default character mode, while lines mode can be more than 100 times faster than the default.

Examples