Skip to content
Varlig Guide
Varlig home

Saved text transformations

A transformation is a small set of find-and-replace rules you save once and apply on purpose: tidy up pasted text, sort a list, strip trailing spaces, wrap a block in a code fence. You choose one from the Format menu, see what it would change, and then decide.

Settings says exactly what they are: “Saved find/replace rules and a few built-in text operations. They are not scripts: Varlig never runs shell commands, plugins or network requests for them, and never applies one on its own — not when importing, pasting or opening a note. You choose one from Format ▸ Transformations and see its changes before anything is applied.”

Where they live

Settings › Editor › Text Transformations holds the list, and it’s empty to begin with: until you add one, Format › Transformations shows No Transformations and nothing runs anywhere.

Add Transformation starts one, named Transformation and holding a single Find and Replace rule. Each transformation has:

Field What it does Starts as
Name What the Format menu calls it. Transformation
Applies to Selection or Whole Note. Selection
Show in Format menu Whether Format › Transformations lists it. On
Rules Add Rule adds one; Remove Last Rule takes the last one off. One Find and Replace

Each row in the list also has a button to duplicate it and one to delete it.

A transformation that isn’t finished — no name, no rules, or a pattern that doesn’t compile — is flagged in Settings with the reason, and left out of Format › Transformations until you fix it.

Saved text transformations follow iCloud between your Mac, iPhone and iPad. On the Mac, turn on Sync notes with iCloud. Each device keeps a local copy in its preferences, so transformations still work offline; they are not included in note exports or library backups.

The rules

Rules run in order, each one on the result of the last. There are no conditions and no branching.

Rule What it does
Find and Replace Literal text, with Match Case and Whole Words (both off to begin with).
Regular Expression An ICU pattern, with $1 and ${name} in the replacement for capture groups.
UPPERCASE Raises the text to capitals.
lowercase Lowers the text.
Title Case Capitalises each word.
Sort Lines Sorts the lines.
Unique Lines Keeps the first of each repeated line.
Trim Trailing Spaces Removes the spaces at the end of each line.
Join Lines Joins the lines with the Separator you give.
Split Lines Splits at the text in Split at, one piece per line.
Wrap in Code Fence Puts the text in a fenced code block, with the Language you give.

A rule is a list of values, never code. Regular expressions are compiled and checked by the same engine as Edit › Find and Replace (Advanced)…, and a pattern that doesn’t compile is flagged in Settings before you ever apply it.

Apply one

On the Mac, run a transformation from Format › Transformations › name. On iPhone and iPad, use the editor’s Transformations menu. Transformations have no keyboard shortcut and never run automatically when you open a note, import, paste or leave the app in the background.

With Applies to set to Selection, select the text first. With Whole Note, the whole note is the scope.

Varlig runs the rules on a copy and shows a preview sheet listing Removes 4 lines and Inserts 4 lines. The lists are trimmed to the part that actually differs, and to 40 lines on each side, with a note when there were more. The footer says “Applying is one undo step. Nothing changes until you press Apply.” Cancel leaves the note alone; Apply makes the change, as a single edit that Edit › Undo (⌘Z) reverses in one step.

If the note has changed since the preview was made, Apply refuses and asks for a new run rather than writing over the newer text.

When a transformation won’t run

Every failure leaves the note exactly as it was — you never get a half-applied transformation. Each one says what happened instead of changing anything:

  • “Transformations don’t run on protected, read-only or trashed notes.” The same goes for a read-only library.
  • “More than 10,000 matches in one rule. Narrow the transformation.”
  • “The transformation took too long. Simplify its rules or use a smaller scope.”
  • “This transformation changes nothing here.”
  • A rule with an invalid pattern, a missing capture group or no text to find, a transformation with no name or no rules, or a Selection transformation run with nothing selected, each named in the message.

Limits

What Limit
Saved transformations 50
Rules in one transformation 20
Matches in one rule 10,000
Time for the whole transformation 1.5 seconds

There’s no dry run across several notes: to change many notes at once, use Edit › Replace in Notes…, which previews each note’s changes separately.

A transformation only ever produces ordinary Markdown, so nothing it writes is special to Varlig, and another editor sees exactly what Varlig saved.