MarkdownDB parses your Markdown files and stores the extracted data in several tables. This page documents every field in each table so you know exactly what comes out of the database when you query it.

File

Each indexed file is stored as a row in the files table. This is the primary object you will work with.

FieldTypeDescription
_idstringSHA-1 hash of the file's relative path. Unique identifier.
file_pathstringAbsolute path to the file on disk.
extensionstringFile extension without the leading dot (e.g. "md", "mdx").
url_pathstring | nullURL-friendly path derived from file_path. The .md/.mdx extension is removed and a trailing index segment is stripped.
filetypestring | nullValue of the type field in the file's frontmatter, if present.
metadataobject | nullAll frontmatter fields as a JSON object.

Example

Given a Markdown file blog/hello-world.md:

---
title: Hello World
date: 2024-01-15
tags: [news, tutorial]
draft: false
---

# Hello World

Welcome to my blog.

The resulting files record looks like:

{
  "_id": "a3f5c2d1e4b6...",
  "file_path": "/content/blog/hello-world.md",
  "extension": "md",
  "url_path": "blog/hello-world",
  "filetype": null,
  "metadata": {
    "title": "Hello World",
    "date": "2024-01-15",
    "tags": ["news", "tutorial"],
    "draft": false
  }
}

Computed fields can add extra top-level properties to this object. See Computed Fields for details.


Tag

Unique tags are stored in the tags table. Tags are extracted from the frontmatter tags array and from inline #tag syntax in the body.

FieldTypeDescription
namestringThe tag string (primary key).

Example

{ "name": "tutorial" }

FileTag

The file_tags table is the many-to-many join between files and tags.

FieldTypeDescription
filestring_id of the file (foreign key → files._id).
tagstringName of the tag (foreign key → tags.name).

Example

{ "file": "a3f5c2d1e4b6...", "tag": "tutorial" }

Every hyperlink ([text](url)) and wiki-style link ([[page]]) found in a file is stored in the links table.

FieldTypeDescription
link_type"normal" | "embed""normal" for regular hyperlinks and wiki links; "embed" for embedded images or iframes.
fromstring_id of the source file (foreign key → files._id).
tostring_id of the target file (foreign key → files._id). Only links whose target exists in the index are stored.

Example

{
  "link_type": "normal",
  "from": "a3f5c2d1e4b6...",
  "to": "b7d9e1f2a3c4..."
}

Task

Tasks (- [ ] … and - [x] … list items) are extracted and stored in the tasks table. MarkdownDB also recognizes inline metadata fields in the form [field:: value].

FieldTypeDescription
descriptionstringFull text of the task item.
checkedbooleantrue if the checkbox is ticked, false otherwise.
duestring | nullValue of the [due:: …] inline field, if present.
completionstring | nullValue of the [completion:: …] inline field, if present.
createdstring | nullValue of the [created:: …] inline field, if present.
startstring | nullValue of the [start:: …] inline field, if present.
scheduledstring | nullValue of the [scheduled:: …] inline field, if present.
liststring | nullFor Kanban boards: the heading of the list that contains the task, otherwise null.
metadataobject | nullAll [field:: value] pairs found in the task description, as a JSON object.

Example

Given the following Markdown:

- [ ] Write release notes
- [x] Ship feature #done [due:: 2024-06-01] [person:: Alice]

The tasks stored are:

[
  {
    "description": "Write release notes",
    "checked": false,
    "due": null,
    "completion": null,
    "created": null,
    "start": null,
    "scheduled": null,
    "list": null,
    "metadata": {}
  },
  {
    "description": "Ship feature #done [due:: 2024-06-01] [person:: Alice]",
    "checked": true,
    "due": "2024-06-01",
    "completion": null,
    "created": null,
    "start": null,
    "scheduled": null,
    "list": null,
    "metadata": {
      "due": "2024-06-01",
      "person": "Alice",
      "tags": ["done"]
    }
  }
]

Database schema diagram

files ──< file_tags >── tags
  └──< links >── files (self-referential)

files ──< tasks

All foreign keys use CASCADE on delete, so removing a file automatically cleans up its tags, links, and tasks.

Built with LogoFlowershow