January 8, 2021

BBEdit Canonize Command

The Canonize command in BBEdit allows you to do a search and replace based on a user-configured file. Basically, each line is a search/replace statement. This is useful when you want to run the same search/replace job as a weekly task.

Hyperlink Database

If you do a lot of blogging, you may have some external links to certain sites. Usually, you make reference to them at least once in the post.

Using the BBEdit Canonize command, you can have BBEdit automatically put in the hyperlinks. Saving you time in putting in hyperlinks yourself.

You can build different Canonize files for different projects.

Sample URL file:

bbedit <a href="https://www.barebones.com/">BBEdit</a> Apple Computer <a href="https://www.apple.com/">Apple Computer</a> Google <a href="https://www.google.com/">Google</a> FireFox <a href="https://www.mozilla.org/en-US/firefox/new/">FireFox</a> Apple ios Store <a href="https://www.apple.com/app-store/">App Store</a>

Save the file in a commonplace - the BBEdit iCloud folder is a very good option.

Using the Canonize Command

The Canonize Command is located in the Text Menu. (There's no keyboard shortcut.)

Select the transformation file that you wish to use.

Limitations

One of the downfalls of the command is that it does a global search and replace. I am still looking for a way to only replace the first match, not all matches.

I see that there's a way to do it in SED, Perl, and PHP. I just haven't figured it using an external data file.

Comments

Add your Comments

Feel free to leave a comment about this post.

- Feel Free to add HTML to your comment!