Skip to navigation

Markup definition

Detects steps from a file. Use regex to match the file’s raw text, one selector kind to match parsed nodes, or a kind with regex to match inside the selected nodes.

Referenced In

Fields

FieldTypeDescriptionDefault
namestringOptional. Name of the markup definition—
regexone of:
- string
- array of string
Optional. Regular expressions to match. Alone, they run on the file’s raw text. With a selector kind, they run on each selected node’s main text, and each occurrence is a match. A node’s main text is its content, else its text, else its alt.—
commentobjectOptional. Selects comments.—
codeBlockone of:
- string
- object
Optional. Selects code blocks. A string selects one language.—
linkobjectOptional. Selects links.—
imageobjectOptional. Selects images.—
strongobjectOptional. Selects bold text.—
emphasisobjectOptional. Selects italic text.—
textobjectOptional. Selects runs of prose, outside code, links, and formatting.—
elementone of:
- string
- object
Optional. Selects elements, such as HTML tags, XML elements, and JSX components. A string selects one tag.—
capturesarray of stringOptional. Fields of each match to use as $1, $2, and so on, in order. Without it, a selector definition uses its regex groups, else the node’s main text. A match.<n> field needs regex on the same definition.—
batchMatchesbooleanOptional. If true, all matches are combined into a single string.false
actionsone of:
- string
- array of one of: string, object
Optional. Actions to perform when the markup type is detected. An action name uses $1 as its value. An object is a step template: $1, $2, and so on are replaced, and the result is checked as a step when it’s detected. A step that isn’t valid is skipped with a warning.—

Examples

{
"name": "runBash",
"codeBlock": "bash",
"actions": [
{
"runShell": "$1"
}
]
}
{
"name": "goToLink",
"link": {
"url": "^https?://",
"precededBy": "\\b[Gg]o to\\s+$"
},
"captures": [
"url"
],
"actions": [
"goTo"
]
}
{
"name": "version",
"text": {},
"regex": "\\bv(\\d+\\.\\d+)\\b",
"actions": [
"find"
]
}
{
"name": "apiCall",
"regex": [
"API:\\s*(GET|POST)\\s+`([^`]+)`"
],
"actions": [
{
"httpRequest": {
"method": "$1",
"url": "$2"
}
}
]
}