Skip to main content

Sections

Datacore tracks each section in markdown files and canvases; sections can be queried by the @section type.

FieldDescriptionExample
$ordinalThe position of this section in the file. The first section has ordinal 0, then 1, and so on.1
$titleThe name of the section.Details
$nameAlias for $title; gives the name of the section.Details
$levelThe section level (i.e., the number of # preceding it).1 - 6
$positionThe position of the section. Datacore positions are recorded as { start, end } line numbers, where start is inclusive and end is exclusive.{ start: 0, end: 7 }
$lineCountThe length of the section in lines.7
$tagsA list of unique tags in the section.["#game", "#todo/revisit"]
$linksA list of all unique links in the section.A list of links.
$linkA Link object that links to this section.[[Dark Souls#Thoughts]]
$blocksA list of markdown blocks inside this section. See the documentation for blocks.See documentation.
$infieldsA list of inline fields for this section.{ "field 1": { key: "field 1", value: "value", raw: "raw unparsed value", position: ... }, ... }
User DataInline fields can be accessed directly on sections in a case-insensitive manner.See below.

Inline Fields

Inline fields on sections can be loaded using the field syntax:

// In queries and expressions, you can just reference the field directly:
@section and row["last reviewed"] > date(now) - dur(7d)

// In javascript, use the field API:
section.value("last reviewed")

JSON Reference

A compact view of every piece of metadata available on a section:

{
$types: ["markdown", "section", "taggable", "linkable", "links", "fields"],
$typename: "Section",
$id: "<unique id>",
$file: "<path-to-file-containing-section>",
$infields: [
"field 1": {
key: "field 1",
value: "<parsed value>",
raw: "<raw unparsed text value>",
position: { start: 0, end: 1 }
},
...
],
$ordinal: <number>,
$title: "<section title>",
$name: "<section title>",
$level: "<1-6 level of section>",
$lineCount: 1, // Number of lines in the file.
// Start and end position of the section in lines. Start position is inclusive; end is exclusive.
$position: { start: 0, end: 1 },
$link: <link-to-file>, // Link object that links to this file.
$tags: ["#tag1", "#tag2/thing"],
$links: [ /* list of Link objects in this section. */ ],
$blocks: [ /* list of blocks in this section. */ ],
}