Skip to end of metadata
Go to start of metadata

Overview

In this recipe, we show how a Ruble command can output a snippet into the editor for further manipulation. Note that this sample already exists in the HTML bundle--we illustrate it here as it is a useful pattern.

The Code

In the snippet below, we manipulate the currently selected text to split it across lines and then wrap each line in a template using mirrored variables (the $1s in the template).

Adding it to a Menu

Icon

If you do not choose a key binding, you should place the command in a menu. Otherwise, it will be difficult or impossible to access.

Result

Once created and activated, you will get something similar to this: