Skip to content

Creating Outline Paths ​

Outline paths are Bike's query language. Use them to match rows and compute values from your outline. They're an advanced feature; you don't need to understand them to use Bike.

Examples:

//pizza
/inbox//task
//task open()
//task @due <[d] today()
//@tags matches "\burgent\b"
//heading union //task

What is an outline path? ​

File paths locate files on your computer. Outline paths locate rows in your outline, and simple ones look just like file paths. Unlike file paths, they often match many rows, and they can work more like database queries.

Outline paths are similar to XPath

If you already know XPath, you're well on your way. Outline paths have a different syntax, but the underlying concepts are very similar.

Where are outline paths used? ​

  1. The filter bar uses outline paths to filter your outline.
  2. Editor styles use relative outline paths to select which rules apply.
  3. The sidebar index uses outline paths to select which rows it includes.
  4. The AppleScript query command takes an outline path and returns the result.
  5. The Shortcuts Query Rows action takes an outline path and returns matching rows.
  6. The extension API's outline.query() method takes an outline path.

Outline Path Explorer ​

Use the Outline Path Explorer to try outline paths and learn how they work.

To open the Outline Path Explorer ​

  1. Open the outline you want to query.
  2. Choose Bike > Outline Path Explorer…

Type an outline path in the top field. The result shows beside the field, matching rows are highlighted in green, and matching text runs in darker green. The diagnostics area at the bottom shows how your path was understood.

The Outline Path Explorer matching rows with a due dateThe Outline Path Explorer matching rows with a due date

The explorer shows each row's text and attributes. Above each row you'll see @id (when the row has a persistent id) and @type, plus any other attributes, such as @status on a checked off task. These are the attributes you can use in your outline paths.

Include View Attributes also shows the text attributes the editor adds for display, such as filter matches, so you can match them in editor styles.

Basic Paths ​

Unlike file paths, the default test is "contains text" instead of "equals file name".

  • /a

    Select top level rows containing "a"

  • /a/b

    Select "b" children of top level "a" rows

  • .a

    A relative path that selects the current row if it contains "a". You won't usually need relative paths, but paths must start with / or . to match rows. Otherwise see "Value Expressions".

Path Expressions ​

Use union, except, and intersect to combine the results of multiple outline paths.

  • /a union /b

    Top level rows that contain "a" or "b"

  • /a except /b

    Top level "a" rows removing "b" rows

  • /a intersect /b

    Top level rows that contain "a" and "b"

  • (/a union /b) except /c

    Top level rows that contain "a" or "b", but not "c"

Path Steps ​

Paths are divided into steps. For example the path /a/b has two steps. Each step contains filtering logic, and you don't have to include every option in each step. These steps all behave the same:

  • /a

    Simple top level contains "a"

  • /* a

    Makes the row type test explicit. * matches any row type.

  • /* @text contains "a"

    Also makes the predicate test explicit. See "Step Predicate" below.

Step Axes ​

By default each step passes the children of the matched rows to the next step, because "child" is the default axis. Other axes are also possible.

Say you want to search your entire outline for "pizza". With only the child axis, you'd need a longer path for each level of the outline:

  • /pizza
  • /*/pizza
  • /*/*/pizza

Instead, use the // descendant axis. It selects all descendants of the rows passed into the step:

  • //pizza

    Selects all descendants of the outline root, then keeps the ones that contain "pizza".

Advanced step axes

Another useful axis is "parent". It uses the same .. syntax that file paths use to go to the parent folder.

  • //pizza/..box

    First use the descendant axis to find "pizza". Then use the .. parent axis to select the parents of those rows, and keep the parents that contain "box". You've found the pizza boxes!

The above examples use the shortcut form of the descendant and parent axes. The general form is the axis name followed by ::. Some axes only have the general form:

  • ancestor::

    All ancestors of the rows passed into the step

  • ancestor-or-self::

    All rows passed into the step and their ancestors

  • parent:: or shortcut ..

    All parents of the rows passed into the step

  • self:: or shortcut .

    All rows passed into the step

  • child::

    All children of the rows passed into the step

  • run::

    All text runs of the rows passed into the step. This axis filters text runs and their attributes, not rows. For example, //*/run::@strong finds all bold text in your outline.

  • descendant:: or shortcut //

    All descendants of the rows passed into the step

  • descendant-or-self::

    All rows passed into the step and their descendants

  • following-sibling::

    All siblings after the rows passed into the step

  • following::

    All rows (in outline order) after the rows passed into the step

  • preceding-sibling::

    All siblings before the rows passed into the step

  • preceding::

    All rows (in outline order) before the rows passed into the step

Step Type ​

Each step can include a row type test at the start.

  • //task

    Match all rows of type task

  • /heading//task

    Match all tasks contained by a top level heading.

  • //"task"

    Match all rows that contain the text "task". Put text in quotes when it conflicts with outline path syntax.

List of types
  • row
  • body
  • heading
  • blockquote
  • codeblock
  • note
  • unordered
  • ordered
  • task
  • log
  • hr
  • run Matches text runs, with the run:: axis
  • * Matches any type

Step Predicate ​

Each step can include a predicate test. Combine predicates with and, or, and not. Use @ to name the row attribute to test.

  • //@status

    Matches rows that have a @status attribute.

  • //not @status

    Matches rows that do not have a @status attribute.

  • //@text contains "get rich"

    Match rows that contain the text "get rich". This example uses the contains relation.

  • //task "get rich" and open()

    Combine predicates. Find all unfinished tasks that will make you rich!

More on row attributes

Each row has attributes that you can test in outline path predicates. Some are built in, others are set by Bike's features, scripts, or extensions. For example, checking off a task sets its @status attribute to done.

The built in attributes are:

  • @text: the row's text
  • @type: the row's type
  • @id: the row's persistent id, when it has one

For a row's depth, use the level() function.

More on comparison relations

Use these relations in comparison predicates:

  • beginswith
  • contains
  • endswith
  • matches
  • =
  • !=
  • <
  • <=
  • >
  • >=

Use relation modifiers in brackets after the relation to change how it's evaluated. For example beginswith[s] is case sensitive instead of the default case insensitive. The modifiers are:

  • i Case insensitive (also ignores diacritics, default)

  • s Case sensitive compare

  • n Numeric compare

    Both sides of the compare are converted to numbers before comparing. Shorthand for wrapping both sides in number(side); see util functions.

  • d Date compare

    Compares both sides as dates: @due <[d] "2026-07-01". Shorthand for wrapping both sides in date(side); see date functions.

Match comparisons ​

The matches relation treats the right side as a regular expression:

  • //@text matches "\bsum\b": the whole word "sum"
  • //@text matches "^Q[1-4]\b": starts with Q1, Q2, Q3, or Q4
  • //@text matches "cats?": "cat" or "cats"
  • //@tags matches "\burgent\b": matches item in a space-delimited list
  • //@cities matches "(^|,)\s*New York\s*(,|$)": matches item in a comma-delimited list

Regex patterns use backslashes, so in an editor style write them with String.raw. See Paths in editor styles.

Step Slice ​

Each step produces an ordered list of matches. Use a slice to limit the step results by position. Positions count from 1, and negative positions count from the end.

  • //a[1]

    Match the first row that contains "a"

  • //a[-1]

    Match the last row that contains "a"

  • //a[2:]

    Match rows 2 through last that contain "a".

  • //a[2:-2]

    Match rows 2 through second to last that contain "a".

  • //a[2:4]

    Match the second, third, and fourth rows that contain "a".

Value Expressions ​

You have already seen value expressions such as a, "a", and @attribute. They each produce a value that your outline path can use. These are all the value expressions:

  • hello world

    Unquoted text that evaluates to hello world.

  • "hello world"

    Quoted text evaluating to hello world. Quote text that would conflict with path syntax. Contents are literal (no backslash escaping), so "\bsum\b" is exactly those characters. A doubled "" is one literal " ("she said ""hi""" → she said "hi").

  • @attribute

    The value of the attribute named "attribute" for the current row (or current run when using the run:: axis). Outside a path step it's always null.

  • functionName(params?)

    A function name followed by () with optional params. See the Functions Reference.

  • 1 or (1 + 1) / 2

    Math that evaluates to 1. Math operators (+, -, *, /) need a single space on each side, so / doesn't conflict with the path step separator. Math doesn't work on text: 1 + "1" is invalid, and 1 + @attribute returns nan if the attribute isn't a number.

  • true, false, or null

    Boolean values, and no value.

If your outline path doesn't start with / or ., it's a value expression. For example, type 1 + 2 in the Outline Path Explorer. No rows match, but the result shows beside the field.

Paths in editor styles ​

An editor style path is also a JavaScript string, and JavaScript strips backslashes before Bike sees the path, so a plain "\b" becomes a backspace and a pattern like matches "\burgent\b" fails. Use String.raw so the path reads the same as in the filter bar:

js
row(String.raw`.@tags matches "\burgent\b"`, (_, row) => {
  row.text.color = Color.systemRed()
})

Or double each backslash for JavaScript's sake ("\\burgent\\b"), which collapses to \burgent\b by the time Bike parses it.

Functions Reference ​

Outline path functions give you:

  1. Easy and efficient access to outline structure.
  2. Access to editor state such as selection and folding.
  3. Date, math, and other utilities.
Outline Functions

These functions give easy and efficient access to outline structure.

You can sometimes get the same result with a more complex outline path. For example, instead of level() you could use count(ancestor::*), but expect level() to be faster.

  • parent() -> boolean

    True if has children

  • level() -> number

    Number of steps to root

  • leaf() -> boolean

    True if has no children

  • root() -> boolean

    True if the element is the outline's root.

  • first-child() -> boolean

    True if is first child of parent

  • last-child() -> boolean

    True if is last child of parent

  • nth-child(n) -> boolean

    True if is the nth child of its parent, counting from 1.

  • first-of-type() -> boolean

    True if is first of type in siblings

  • last-of-type() -> boolean

    True if is last of type in siblings

  • nth-of-type(n) -> boolean

    True if is the nth sibling of its type, counting from 1.

  • only-child() -> boolean

    True if has no siblings

  • only-of-type() -> boolean

    True if is only of type in siblings

  • open() -> boolean

    True if the row's @status is todo or started, or absent (absent is todo).

  • closed() -> boolean

    True if the row's @status is done or canceled.

    Prefer open() and closed() to naming the states yourself. not (@status = "done" or @status = "canceled") means the same thing today, but it will miss any states added later.

  • start-of-matches(relative path expression) -> boolean

    True if element matches relative path and previous sibling does not. Useful when styling attribute runs and you want to special case the first match in a sequence of matching runs. The preceding-sibling axis can do the same, but this function is shorter and faster.

  • end-of-matches(relative path expression) -> boolean

    True if element matches relative path and next sibling does not. Useful when styling attribute runs and you want to special case the last match in a sequence of matching runs. The following-sibling axis can do the same, but this function is shorter and faster.

Editor Functions

These functions give access to editor state. They only work when your outline path is evaluated in an outline editor, usually in editor styles. For example, use focused-root() to style the focused root row differently from other rows.

  • focused-root() -> boolean

    True if row is the focused root

  • focused-branch() -> boolean

    True if row is in the focused branch

  • focused-level() -> number

    Number of steps to focused root, or max value if not focused

  • expanded() -> boolean

    True if row is expanded

  • collapsed() -> boolean

    True if row is collapsed

  • filter-match() -> boolean

    True if row is matched

  • filter-match-ancestor() -> boolean

    True if row is ancestor of matched row

  • selection() -> caret|range|block|null

    Returns row selection type

  • selection-ancestor() -> caret|range|block|null

    Selection type if this row is ancestor of a selected row

  • selection-descendant() -> caret|range|block|null

    Selection type if this row is descendant of selected row

  • selection-branch() -> block|null

    block if this unselected row will move with a block selection, because row commands include children

  • selection-first() -> boolean

    True if row is the first row of a block selection

  • selection-last() -> boolean

    True if row is the last row of a block selection

  • selected-newline() -> upstream|downstream|null

    Which side of a selected newline this row is on

  • drop-indicator() -> on|above|below|null

    Drop indicator state for this row

  • summary(name) -> value

    The named summary's value for this row's branch, such as a count or sum that an extension defines

Context Functions
  • last() -> number

    Size of the evaluation context

  • position() -> number

    Current position in evaluation context

Date Functions

A date is a number, so you compare dates with the normal relations and add or subtract with + and - (which need a single space on each side).

  • date(value) -> number

    Interprets its argument as a date: date("2026-07-01") for a literal, date(@due) for an attribute. Accepts a year (2026), year-month (2026-07), full date (2026-07-01), or full timestamp (2026-07-01T13:53:00Z). A bare date resolves to midnight in your local time zone; a timestamp keeps its own zone. The [d] modifier is shorthand for wrapping both sides of a compare in date().

  • now() -> number

    The current date and time.

  • today() -> number

    The start of today, in local time.

The duration functions return a length of time to add or subtract. They're fixed lengths, so days(1) is always 24 hours, even across a daylight-saving change.

  • seconds(number) -> number

  • minutes(number) -> number

  • hours(number) -> number

  • days(number) -> number

  • weeks(number) -> number

  • duration(text) -> number

    An ISO 8601 duration in seconds: now() + duration("P3D").

The start-of functions return a calendar boundary, offset by a whole number of periods: 0 (the default) is the current period, 1 the next, -1 the previous. They're calendar aware, so start-of-month(1) is always the first of next month. The week starts on your calendar's first day of the week.

  • start-of-day(offset?) -> number
  • start-of-week(offset?) -> number
  • start-of-month(offset?) -> number
  • start-of-year(offset?) -> number

The component functions pull a single field out of a date, in local time. weekday is 1 (Sunday) through 7 (Saturday).

  • year(date) -> number
  • month(date) -> number
  • day(date) -> number
  • weekday(date) -> number
  • hour(date) -> number
  • minute(date) -> number
  • second(date) -> number

The interval and repeat functions read ISO 8601 intervals (2026-07-01/P3D) and repeating intervals (R5/2026-07-01/P1W). Text that doesn't parse returns nan.

  • interval-start(text) -> number

  • interval-end(text) -> number

  • interval-duration(text) -> number

    The interval's length in seconds.

  • repeat-count(text) -> number

    How many times it repeats, or infinity when unbounded.

  • repeat-interval(text) -> number

    The length of each repeat in seconds.

Some examples:

  • @due <[d] today()

    Rows due before the start of today.

  • @due <[d] today() + days(7)

    Rows due within the next seven days.

  • @due >=[d] start-of-week(0) and @due <[d] start-of-week(1)

    Rows due this week.

  • @due <[d] start-of-month(1)

    Rows due before next month starts.

  • @log-date >=[d] start-of-year(0)

    Log entries recorded this year. See Row Log.

  • month(@due) = 6

    Rows due in June, in any year.

  • weekday(@due) = 1 or weekday(@due) = 7

    Rows due on a weekend.

  • date(@due) < now() - weeks(1)

    Same idea using date() instead of the [d] shorthand.

Util Functions
  • floor(number) -> number

  • ceil(number) -> number

  • round(number) -> number

  • count(expression) -> number

  • boolean(expression) -> boolean

  • number(value) -> number

    Interprets its argument as a number (non-numbers become nan). This is the function twin of the [n] modifier: x OP[n] y is the same as number(x) OP number(y).

See also ​