This project aims to provide an easy way for migrating Notion Wikis from your organization to MkDocs. We had a use case in which we were needing to migrate all the content that we have been generating in our Notion wiki to other system/platform. Since MkDocs is extending as powerful solution for managing wikis, we decided to give it a try thinking always with the automation first mindset.
Important
Do not forget to change the Architecture picture/diagram and delete the label
- Docker
- Python 3.10+
Install Docker Engine
. Visit https://docs.docker.com/engine/install/ for more information.
- Build docker image:
docker build . -t notion-exporter:1.0
- Run docker image:
docker run -it --name notion-exporter --rm -v $(pwd):/app --user $(id -u):$(id -g) -e NOTION_TOKEN="" -e NOTION_REQUEST_WAIT_TIME="500" notion-exporter:1.0 list all -p bc3caa74-66ba-4cd1-bfcd-02f18521903e
Tip
You can play with the NOTION_REQUEST_WAIT_TIME (in ms)
value. This will set the delay in between requests to the API. Notice that Notion allows
on average 3 requests per second by the integration. Therefore, to not get blocked the bare minimum wait time should be 333 theoretically.
- After the assets have been generated from Notion if everything went well, you can build the mkdocs image:
docker build . -f Dockerfile.mkdocs -t mkdocs:1.0
- Finally, you can set up you mkdocs wiki with the contents from your Notion.
docker run -d --name mkdocs -e MKDOCS_SITE="https://example.com" -e MKDOCS_PORT="8000" -e MKDOCS_INTERFACE="0.0.0.0" -e MKDOCS_SITE_NAME="mkdocs" -p 8000:8000 mkdocs:1.0
Tip
TOEDIT: Use this space to show useful examples of how a project can be used. Additional screenshots, code examples and demos work well in this space. You may also link to more resources.
For quick development set-up leveraging Docker, you can use the build image and run it eternally:
docker run -it --name notion-exporter --rm -v $(pwd):/app --user $(id -u):$(id -g) -e NOTION_TOKEN="" -e NOTION_REQUEST_WAIT_TIME="500" --entrypoint sh notion-exporter:1.0
If you need to install additional dependencies, you can access the container in a different terminal with root
permissions:
docker exec -it -u 0:0 notion-exporter sh
This way you would be able to develop without having to concern about dependencies installation in your host system, testing and breaking as you like.
- Functionality:
- Export Notion wiki.
- Parametrized execution for reusability.
- Indentation with 4 spaces for compatibility with Syntax rules for python-markdown - MkDocs
- Include support for databases (currently only pages and blocks)
- Deployment:
- Bundle automation in Docker image definition.
- Prepare automation to deploy in kubernetes cluster with Helm.
See the open issues for a full list of proposed features (and known issues).
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated 💹.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement".
- Fork the Project
- Create your Feature Branch
git checkout -b feature/AmazingFeature
- Commit your Changes
git commit -m 'Add some AmazingFeature
- Push to the Branch
git push origin feature/AmazingFeature
- Open a Pull Request
Distributed under the Apache2.0
License. See LICENSE for more information.
As we always state, our main purpose is keep learning, contributing to the community and finding ways to collaborate in interesting initiatives.
Do not hesitate to contact us at codetriariism@gmail.com
If you are interested in our content creation, also check our social media accounts. We have all sorts of training resources, blogs, hackathons, write-ups and more! Do not skip it, you will like it 😏 😏 😏 👍
Don't forget to give the project a star if you liked it! Thanks again! 🌟 💛
- Notion API Reference - Giving us the details for executing the required queries.
- Working with Notion Page content - API
💯 💯 💯 For those that are curious about some of the resources or utilities and for sure thanking and giving credit to authors, we provide you a list of the most interesting ones (in our understanding) 💯 💯 💯