Skip to content

Notion to Markdown exporter

Actions
Export a Notion workspace to a set of Markdown files in the current working directory
v1.0.0
Latest
Star (0)

Tags

 (1)

This action exports all documents an integration can access within a Notion workspace to markdown files.

Usage

You will need to create a Notion integration with an API token in order to power the Notion export. In other to do that you will need to follow the instructions here:

Once you create the integration update the Capabilities section to only grant your integration access to "Read content" and nothing else. This is the only required permission to power the Notion export.

After you've narrowed the permissions, get the API secret by following the instructions here:

Copy that "Internal Integration Secret" and visit the secrets page for your repository, which is located at:

https://github.com/${owner}/${repository}/settings/secrets/actions

… and click the "New repository secret" to add a new secret named NOTION_TOKEN (any name will do, as long as it matches the name you reference in your GitHub workflow):

… and then pass that secret as an input to this GitHub action:

- uses: Gabriella439/notion-to-markdown@main
  with:
    notion-token: ${{ secrets.NOTION_TOKEN }}

Finally, grant the integration access to the Notion pages you want to export by following the instructions here:

Now any time the GitHub action runs it will export the pages you granted access to as local files of the same name within its current working directory.

If you want to add those exported files to version control then you will probably want to combine this GitHub action with the actions/checkout and the EndBug/add-and-commit GitHub actions. See the next section for a worked example.

Example

Here is an example GitHub workflow that shows how you can create a manual or daily export of your notion workspace to the current repository:

name: Import Notion
on:
  workflow_dispatch:
  schedule:
  - cron: '0 0 * * *'
jobs:
  import-notion:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - run: 'rm --force -- *.md'
    - uses: Gabriella439/notion-to-markdown@main
      with:
        notion-token: ${{ secrets.NOTION_TOKEN }}
    - uses: EndBug/add-and-commit@v9

Notion to Markdown exporter is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.

About

Export a Notion workspace to a set of Markdown files in the current working directory
v1.0.0
Latest

Tags

 (1)

Notion to Markdown exporter is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.