Docs
Configuration

Configuration

Configuration options for notion-downloader.

Options

rootId

Type: string

The ID of the Notion page or database to use as the root of your documentation. You can find the ID in the URL of the page or database.

{
  "rootId": "9120ec9960244ead80fa2ef4bc1bba25"
}

rootObjectType

Type: "page" | "database"

The type of the root object. Must be either "page" or "database".

{
  "rootObjectType": "page"
}

cache

Type: object

Configuration options for caching.

cache.cacheDirectory

Type: string Default: "./.downloader"

The directory to use for caching downloaded files.

cache.cleanCache

Type: boolean Default: false

Whether to clean the cache before downloading files.

cache.cacheStrategy

Type: "cache" | "no-cache" | "force-cache" Default: "cache"

The caching strategy to use:

  • "cache": Use cached files if available, otherwise download them.
  • "no-cache": Always download files, ignoring the cache.
  • "force-cache": Only use cached files, never download them.
{
  "cache": {
    "cacheDirectory": "./.downloader",
    "cleanCache": false,
    "cacheStrategy": "cache"
  }
}

conversion

Type: object

Configuration options for converting Notion pages to Markdown.

conversion.skip

Type: boolean Default: false

Whether to skip converting Notion pages to Markdown.

{
  "conversion": {
    "skip": false
  }
}

output

Type: object

Configuration options for output files.

output.directory

Type: string Default: "./docs"

The directory to output downloaded files to.

{
  "output": {
    "directory": "./docs"
  }
}

naming

Type: object

Configuration options for naming downloaded files.

naming.strategy

Type: object

The naming strategy to use for different file types. You can specify a strategy for all files, assets, Markdown files, or individual asset types.

Possible values:

  • "default": Use the default naming strategy for the file type.
  • "guid": Use a generated GUID for the file name.
  • "githubSlug": Use the GitHub slug of the page title for Markdown files.
  • "notionSlug": Use the Notion slug of the page title for Markdown files.
  • "title": Use the page title for Markdown files.
  • "legacy": Use the legacy naming strategy for assets.
  • "ancestorPrefix": Prefix asset names with the names of their ancestor pages.
{
  "naming": {
    "strategy": {
      "all": "default",
      "assets": "legacy",
      "markdown": "githubSlug",
      "image": "ancestorPrefix",
      "file": "guid",
      "video": "default",
      "pdf": "default",
      "audio": "default"
    }
  }
}

naming.prefix

Type: string Default: ""

A prefix to add to all downloaded file names.

{
  "naming": {
    "prefix": "docs-"
  }
}

layout

Type: object

Configuration options for the layout of downloaded files.

layout.strategy

Type: "hierarchical" | "flat" Default: "hierarchical"

The layout strategy to use:

  • "hierarchical": Organize files in a hierarchy based on the Notion page structure.
  • "flat": Put all files in a single flat directory.

You can specify a layout strategy for all files or individual file types.

{
  "layout": {
    "strategy": {
      "all": "hierarchical",
      "markdown": "flat",
      "image": "hierarchical",
      "file": "flat",
      "video": "hierarchical",
      "pdf": "hierarchical",
      "audio": "hierarchical"
    }
  }
}

logging

Type: object

Configuration options for logging.

logging.level

Type: "info" | "verbose" | "debug" Default: "info"

The minimum log level to output. Logs below this level will be suppressed.

{
  "logging": {
    "level": "verbose"
  }
}

Full Configuration Example

Here's an example downloader.json file with all options set:

{
  "notionToken": "secret_abc123def456ghi789jkl012mno345pqr678stu901",
  "rootId": "9120ec9960244ead80fa2ef4bc1bba25",
  "rootObjectType": "page",
  "cache": {
    "cacheDirectory": "./.downloader",
    "cleanCache": false,
    "cacheStrategy": "cache"
  },
  "conversion": {
    "skip": false
  },
  "output": {
    "directory": "./docs"
  },
  "naming": {
    "strategy": {
      "all": "default",
      "assets": "legacy",
      "markdown": "githubSlug",
      "image": "ancestorPrefix",
      "file": "guid",
      "video": "default",
      "pdf": "default",
      "audio": "default"
    },
    "prefix": "docs-"
  },
  "layout": {
    "strategy": {
      "all": "hierarchical",
      "markdown": "flat",
      "image": "hierarchical",
      "file": "flat",
      "video": "hierarchical",
      "pdf": "hierarchical",
      "audio": "hierarchical"
    }
  },
  "logging": {
    "level": "verbose"
  }
}