The Outline feature in CotEditor lets you quickly navigate a document by listing its structural elements. You can define outline extraction rules that determine which parts of text appear in the Outline menu and how they are displayed.
To define the rules to extract the outline for a syntax, select Outline from the list on the left of the syntax editor, then add conditions to the list on the right side. See Define a syntax for how to open the syntax editor.
The options for the Outline settings are as follows:
| Field | Description |
|---|---|
| IC | If selected, the case is ignored for searching. For example, the expression “abc” matches “ABC” or “abc” or “Abc” in your document (IC stands for Ignore Case). |
| Kind | The kind of the outline item. Used for the icon displayed in front of the title. |
| Regular Expression Pattern | The strings in the document matched by the regular expressions you set here appear in the outline menu. This setting is required to search the items to be listed. |
| Display Pattern | Here, you can format the titles of the Outline items. Both the Regular Expression Pattern setting and the setting here determine how the corresponding item is titled in the list. |
| Description | A note or comment for your reference. The description doesn’t affect the extraction and may be left blank. |
The metacharacters you can use in the display pattern are as follows:
| Metacharacter | Description |
|---|---|
| (blank) | The whole string matched by your regular expression pattern. |
$0 | The whole string matched by your regular expression pattern. |
$1 ... $9 | The string matched by the first through ninth parenthesized subexpression in your regular expression pattern. |
To show a metacharacter such as “$0” in the menu, you need to put a backslash (\) in front of it. You won’t see that backslash (\) in the menu.
You can assign an icon to display next to an outline title by selecting one for a rule.
| Kind | Description | Examples |
|---|---|---|
| Container | A named structural block that can contain other items. | class, struct, enum, protocol, extension, namespace |
| Value | A value-like symbol such as a property, field, variable, constant, or comparable entry. | property, enum case, const |
| Function | A callable symbol such as a function, method, or similar invocable member. | function, method, def, init |
| Title | A title that names the document, a figure, or content. | title, figcaption |
| Heading | A document heading that defines the hierarchy of sections. You can optionally specify the heading level (1–7) to create a hierarchical outline with collapsible sections. | h1–h6, section{}/subsection{} (LaTeX) |
| Mark | A human-authored marker used to visually group or annotate sections without being a formal heading. | MARK:, #pragma mark, region/endregion |
| Separator | A separator is a non-selectable divider that visually groups outline items. | <hr>, ---, MARK: - |
| None | Unclassified item with no semantic kind assigned. |