Skip to main content

Markdown Conversion

ntnsync converts Notion pages to GitHub-flavored Markdown with YAML frontmatter.

Frontmatter​

All markdown files begin with YAML frontmatter containing page metadata:

---
ntnsync_version: 0.8.1
notion_id: 2c536f5e-48f4-4234-ad8d-73a1a148e95d
title: "Page Title"
notion_type: page
notion_folder: tech
file_path: tech/wiki/page.md
created_by: "Jane Doe <jane@example.com> [751deade]"
last_edited_by: "John Smith <john@example.com> [306d872b]"
last_edited: 2025-12-10T13:39:00Z
last_synced: 2026-01-18T18:05:06+01:00
icon: "emoji:📝"
notion_parent_id: abc123def456
is_root: false
notion_url: https://www.notion.so/2c536f5e48f44234ad8d73a1a148e95d
download_duration: 2.559393503s
---
FieldDescription
ntnsync_versionVersion of ntnsync that wrote the file
notion_idPage ID with dashes
titlePage title (omitted when empty)
notion_typepage or database
notion_folderFolder name
file_pathRelative path for self-reference
created_byPage creator as Name <email> [short-id] (first 8 chars of the user ID)
last_edited_byLast editor, same format as created_by
last_editedLast edit timestamp from Notion
last_syncedLocal sync timestamp
iconPage icon: emoji:📝, external:<url>, or file:<url> (omitted when unset)
notion_parent_idParent page/database ID (omitted for root pages)
is_rootWhether this is a root page
notion_urlNotion web URL
simplified_depthOnly present when block discovery was depth-limited (NTN_BLOCK_DEPTH)
download_durationHow long the page took to download

Database Entry Properties​

Pages whose parent is a database (database rows) additionally carry their database properties under the properties key, sorted by property name. Values are flattened to display values; properties with no value are omitted:

properties:
Priority: "High"
Status: "In Progress"
Tags:
- "feature"
- "urgent"
Notion property typeExported as
rich_textPlain text string
numberNumber
select, statusOption name
multi_selectList of option names
dateStart date string
checkboxtrue / false
url, email, phone_numberString
peopleList of user IDs
relationList of related page IDs
formula, rollupComputed value (string, number, boolean, or date)
created_by, last_edited_byUser ID
created_time, last_edited_timeTimestamp
unique_idPREFIX-123 (or the bare number without a prefix)
titleSkipped — already exported as title

Block Type Conversions​

Text Blocks​

Paragraph

Regular paragraph text.

Headings

# Heading 1
## Heading 2
### Heading 3

Toggleable headings include collapsible markers:

# Toggleable Heading
<!-- collapsible: start -->
Content inside toggle
<!-- collapsible: end -->

Lists​

Bulleted list

- Item 1
- Nested item
- Deeper nested

Numbered list

1. First item
1. Nested numbered

To-do list

- [ ] Unchecked task
- [x] Checked task

Toggle Blocks​

<!-- collapsible: start -->
**Toggle Title**

Content inside toggle
<!-- collapsible: end -->

Code Blocks​

```python
def hello():
print("world")
```

The language identifier comes from Notion's code block language setting.

Quotes and Callouts​

Block quote

> This is a quote
> Multiple lines are prefixed

Callout (includes emoji)

> [emoji] Callout content
> Multi-line callout content

Media and Files​

Image

![alt text](https://url)<!-- file_id:abc123 -->

File

[Document.pdf](https://url)<!-- file_id:abc123 -->

Bookmark

[Bookmark](https://example.com)

Embed

[Embed](https://example.com/embed)

Tables​

| Column 1 | Column 2 |
| --- | --- |
| Cell 1 | Cell 2 |

Divider​

---

Equations​

$$
E = mc^2
$$

Table of Contents​

[TOC]

Child page reference

- [Child Page](./parent-dir/child-page.md)<!-- page_id:abc123 -->

Child database reference

- [Child Database](./parent-dir/db-name.md)<!-- page_id:abc123 -->

Inline page link

[Page Link](notion://page/abc123def456)<!-- page_id:abc123def456 -->

Inline database link

[Database Link](notion://database/xyz789)<!-- page_id:xyz789 -->

The <!-- page_id:... --> comment allows tools to track references even if filenames change.

Database Content​

Database pages display their child pages as a list:

---
notion_type: database
...
---

# Database Title

Database description (if any)

- [Page 1](./database/page-1.md)<!-- page_id:abc -->
- [Page 2](./database/page-2.md)<!-- page_id:def -->

Rich Text Formatting​

All rich text fields support inline formatting:

Notion FormatMarkdown
Bold**text**
Italic_text_
Strikethrough~~text~~
Code`text`
Link[text](url)

Mentions (users, dates, pages) are converted to plain text.

ID Comments​

To preserve references when filenames change, ntnsync adds HTML comments with IDs:

  • Files: <!-- file_id:abc123 -->
  • Pages: <!-- page_id:abc123 -->

These comments appear after links and images to enable tooling that needs to track references across renames.