Text Transform
This shortcut transforms text in the clipboard according to the string passed into the shortcut:
- upper: UPPERCASE
- lower: lowercase
- capitalize: Capitalize
- title: Title Case
- sentence: Sentence case
- alternating: AlTeRnAtInG cAsE
- trim: Trim Whitespace
- slug: Slug
- clear: Clear the clipboard
If no input is provided to the shortcut, a menu will appear allowing you to choose from one of the following actions:
- Transform: Apply a selected transform to the clipboard contents.
- View Clipboard: View the contents of the clipboard via Quick Look.
- Create Deck: Create a text editing deck in MFC Deck.
- Get MFC Deck: Download MFC Deck from the App Store.
- Quit: Exit the shortcut.
Create Deck
This option creates a deck named Text Editing
in MFC Deck. You can use this as a text editing control panel. If a deck already exists with the name Text Editing
, you will be asked if you want to replace the existing deck.
Using the Text Editing Deck
The Text Editing deck becomes very handy if you have Handoff enabled on your various iCloud-connected devices. This is because changes you make to the clipboard will automatically synced to the other computer.
For instance, suppose you are writing a page for GitHub Pages in Markdown and are creating links to various headings in your document. The headings will automatically be accessible by an HTML Fragment:
# Primary Heading
## Secondary Heading
### Tertiary Heading???
### A Really Long Subheading With Someone's Name
You can use the Text Editing deck to generate the slug for each of the headings without having to manually format them into a slug format.
- Copy text to the clipboard that you want to slugify.
- Open MFC Deck.
- Open the Text Editing deck.
- Tap the Slug card.
- [Primary Heading](#primary-heading)
- [Secondary Heading](#secondary-heading)
- [Tertiary Heading???](#tertiary-heading)
- [A Really Long Subheading With Someone's Name](#a-really-long-subheading-with-someones-name)
The clipboard contents will be slugified and copied back to the clipboard. The first card shows the contents of the clipboard before and after the transformation.
Adding Additional Text Transformations
You can modify the Text Transform shortcut to add your own text transformations when running the shortcut or calling it from a deck. You’ll want to keep the following things in mind:
- The contents of the clipboard are contained within the
Text
variable. - The
Transform
variable will contain a lowercased string that you must match to an If clause. - Your code should return the string that will be copied back to the clipboard.
- Add your transform string name (lowercase not required)
- Add a Create Card action in the routine which creates a new deck in MFC Deck. Duplicate an existing Create Card action and change the shortcut input to the name of your transform method.