Skip to content

Commit 74f34d8

Browse files
committed
notion-pull --> notion-pull-mdx
1 parent 95d8d7a commit 74f34d8

File tree

7 files changed

+26
-26
lines changed

7 files changed

+26
-26
lines changed

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
# notion-pull
1+
# notion-pull-mdx
22

3-
notion-pull lets you use Notion as your editor for markdown-based static site generators like [Docusaurus](https://docusaurus.io/). Using Notion instead of raw markdown files means that you don't have to teach non-developers how to make git commits and pull requests. It also allows you to leverage Notion's database tools to control workflow, Notion's commenting feature to discuss changes, etc.
3+
notion-pull-mdx lets you use Notion as your editor for markdown-based static site generators like [Docusaurus](https://docusaurus.io/). Using Notion instead of raw markdown files means that you don't have to teach non-developers how to make git commits and pull requests. It also allows you to leverage Notion's database tools to control workflow, Notion's commenting feature to discuss changes, etc.
44

5-
Example Site: https://sillsdev.github.io/notion-pull-sample-site/
5+
Example Site: https://sillsdev.github.io/notion-pull-mdx-sample-site/
66

77
# Instructions
88

99
## 1. Set up your documentation site.
1010

11-
First, prepare your markdown-based static file system like [Docusaurus](https://docusaurus.io/). For a shortcut with github actions, search, and deployment to github pages, you can just copy [this template](https://github.com/sillsdev/notion-pull-sample-site).
11+
First, prepare your markdown-based static file system like [Docusaurus](https://docusaurus.io/). For a shortcut with github actions, search, and deployment to github pages, you can just copy [this template](https://github.com/sillsdev/notion-pull-mdx-sample-site).
1212

13-
## 2. In Notion, duplicate the notion-pull template
13+
## 2. In Notion, duplicate the notion-pull-mdx template
1414

1515
Go to [this template page](https://hattonjohn.notion.site/Documentation-Template-Docusaurus-0e998b32da3c47edad0f62a25b49818c). Duplicate it into your own workspace.
1616
You can name it anything you like, e.g. "Documentation Root".
1717

1818
## 3. Create a Notion Integration
1919

20-
In order for notion-pull to read your site via Notion's API, you need to create what Notion calls an "integration". Follow [these instructions](https://developers.notion.com/docs/getting-started) to make an integration and get your token. Limit your integration to "READ" access.
20+
In order for notion-pull-mdx to read your site via Notion's API, you need to create what Notion calls an "integration". Follow [these instructions](https://developers.notion.com/docs/getting-started) to make an integration and get your token. Limit your integration to "READ" access.
2121

2222
## 4. "Invite" your Notion Integration to read you page
2323

@@ -27,7 +27,7 @@ In Notion, click "Share" on the root of your documentation and "invite" your int
2727

2828
## 5. Add your pages under your Outline page.
2929

30-
Currently, notion-pull expects that each page has only one of the following: subpages, links to other pages, or normal content. Do not mix them. You can add content pages directly here, but then you won't be able to make use of the workflow features. If those matter to you, instead make new pages under the "Database" and then link to them in your outline pages.
30+
Currently, notion-pull-mdx expects that each page has only one of the following: subpages, links to other pages, or normal content. Do not mix them. You can add content pages directly here, but then you won't be able to make use of the workflow features. If those matter to you, instead make new pages under the "Database" and then link to them in your outline pages.
3131

3232
## 6. Pull your pages
3333

@@ -38,24 +38,24 @@ means that the id is "0456aa5842946PRETEND4f37c97a0e5".
3838
Determine where you want the markdown files and images to land. The following works well for Docusaurus instances:
3939

4040
```
41-
npx notion-pull -n secret_PRETEND123456789PRETEND123456789PRETEND6789 -r 0456aa5842946PRETEND4f37c97a0e5 -m "./docs" -i "./images"
41+
npx notion-pull-mdx -n secret_PRETEND123456789PRETEND123456789PRETEND6789 -r 0456aa5842946PRETEND4f37c97a0e5 -m "./docs" -i "./images"
4242
```
4343

4444
Likely, you will want to store these codes in your environment variables and then use them like this:
4545

4646
```
4747
(windows)
48-
npx notion-pull -n %MY_NOTION_TOKEN% -r %MY_NOTION_DOCS_ROOT_PAGE_ID% -m "./docs" -i "./static/notion_images" -p "/notion_images/"
48+
npx notion-pull-mdx -n %MY_NOTION_TOKEN% -r %MY_NOTION_DOCS_ROOT_PAGE_ID% -m "./docs" -i "./static/notion_images" -p "/notion_images/"
4949
```
5050

5151
```
5252
(linux / mac)
53-
npx notion-pull -n $MY_NOTION_TOKEN -r $MY_NOTION_DOCS_ROOT_PAGE_ID -m "./docs" -i "./static/notion_images" -p "/notion_images/"
53+
npx notion-pull-mdx -n $MY_NOTION_TOKEN -r $MY_NOTION_DOCS_ROOT_PAGE_ID -m "./docs" -i "./static/notion_images" -p "/notion_images/"
5454
```
5555

5656
## 7. Commit
5757

58-
Most projects should probably commit the current markdown and image files each time you run notion-pull.
58+
Most projects should probably commit the current markdown and image files each time you run notion-pull-mdx.
5959

6060
Note that if you choose not to commit, the workflow feature (see below) won't work for you. Imagine the case where a document that previously had a `Status` property of `Publish` now has a different status. You probably want to keep publishing the old version until the new one is ready. But if you don't commit files, your CI system (e.g. Github Actions) won't have the old version around, so it will disappear from your site.
6161

@@ -65,17 +65,17 @@ One of the big attractions of Notion for large documentation projects is that yo
6565

6666
![image](https://user-images.githubusercontent.com/8448/168929745-e6529375-bb1e-47e9-b8a6-7a1467c8900f.png)
6767

68-
`notion-pull` supports this by letting you link to database pages from your outline.
68+
`notion-pull-mdx` supports this by letting you link to database pages from your outline.
6969

7070
![image](https://user-images.githubusercontent.com/8448/168929668-f83d7c86-75d2-48e9-940c-84c5268a2854.png)
7171

7272
## Known Limitations
7373

74-
notion-pull is not doing anything smart with regards to previously Published but now not Published documents. All it does is ignore every Notion document that doesn't have `status == Publish`. So if the old version of the document is still in your file tree when your static site generator (e.g. Docusaurus) runs, then it will appear on your website. If it isn't there, it won't. If you rename directories or move the document, notion-pull will not realize this and will delete the previously published markdown file.
74+
notion-pull-mdx is not doing anything smart with regards to previously Published but now not Published documents. All it does is ignore every Notion document that doesn't have `status == Publish`. So if the old version of the document is still in your file tree when your static site generator (e.g. Docusaurus) runs, then it will appear on your website. If it isn't there, it won't. If you rename directories or move the document, notion-pull-mdx will not realize this and will delete the previously published markdown file.
7575

7676
Links from one document to another in Notion are not yet converted to local links.
7777

78-
Notion-pull makes some attempt to keep the right order of things, but there are definitely cases where it isn't smart enough yet.
78+
notion-pull-mdx makes some attempt to keep the right order of things, but there are definitely cases where it isn't smart enough yet.
7979

8080
# Localization
8181

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "notion-pull",
2+
"name": "notion-pull-mdx",
33
"version": "0.0.0-development",
44
"description": "Download Notion pages as markdown and image files, preserving hierarchy and enabling workflow properties. Works with Docusaurus.",
55
"main": "./dist/index.js",
@@ -20,7 +20,7 @@
2020
},
2121
"repository": {
2222
"type": "git",
23-
"url": "git+https://github.com/sillsdev/notion-pull.git"
23+
"url": "git+https://github.com/sillsdev/notion-pull-mdx.git"
2424
},
2525
"license": "MIT",
2626
"author": {
@@ -37,9 +37,9 @@
3737
"markdown"
3838
],
3939
"bugs": {
40-
"url": "https://github.com/sillsdev/notion-pull/issues"
40+
"url": "https://github.com/sillsdev/notion-pull-mdx/issues"
4141
},
42-
"homepage": "https://github.com/sillsdev/notion-pull#readme",
42+
"homepage": "https://github.com/sillsdev/notion-pull-mdx#readme",
4343
"//file-type": "have to use this version before they switched to ESM, which gives a compile error related to require()",
4444
"//node-fetch@2.6.6file-type": "have to use this version before they switched to ESM, which gives a compile error related to require()",
4545
"//chalk@4": "also ESM related problem",

src/DocusaurusTweaks.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ function notionEmbedsToMDX(input: string): {
6363
regex: /\[.*\]\((http.*(\.(gif|GIF)))\)/gm,
6464
...gif,
6565
},
66-
// This is included in notion-pull just because we built notion-pull for our own doc site, and it needs this.
66+
// This is included in notion-pull-mdx just because we built notion-pull-mdx for our own doc site, and it needs this.
6767
// bloomPUB: {
6868
// regex: /\[.*\]\((.*bloomlibrary\.org.*.*book.*)\)/gm,
6969
// // enhance: it would be nice if we could fill in the `host` parameter for analytics

src/NotionPage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const notionLimiter = new RateLimiter({
1515
let notionClient: Client;
1616

1717
// Notion has 2 kinds of pages: a normal one which is just content, and what I'm calling a "database page", which has whatever properties you put on it.
18-
// notion-pull supports the later via links from outline pages. That is, you put the database pages in a database, then separately, in the outline, you
18+
// notion-pull-mdx supports the later via links from outline pages. That is, you put the database pages in a database, then separately, in the outline, you
1919
// create pages for each node of the outline and then add links from those to the database pages. In this way, we get the benefits of database
2020
// pages (metadata, workflow, etc) and also normal pages (order, position in the outline).
2121
export enum PageType {

src/css/notion-styles.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
.notion-row {
2424
display: grid;
2525
grid-auto-flow: column;
26-
/* at the moment, notion-pull doesn't give us column widths or ratios. So we
26+
/* at the moment, notion-pull-mdx doesn't give us column widths or ratios. So we
2727
could let css layout decide the widths. Instead at the moment we're saying
2828
let's just have each column be equal. This is easier for the author using
2929
Notion to remember than having to guess at what the layout will be. */

src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import { program } from "commander";
55
import { notionPull } from "./pull";
66
const pkg = require("../package.json");
77
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
8-
console.log(`notion-pull version ${pkg.version}`);
8+
console.log(`notion-pull-mdx version ${pkg.version}`);
99

10-
program.name("notion-pull").description("");
10+
program.name("notion-pull-mdx").description("");
1111
program
1212
.requiredOption("-n, --notion-token <string>", "notion api token")
1313
.requiredOption(
@@ -35,5 +35,5 @@ program.showHelpAfterError();
3535
program.parse();
3636

3737
void notionPull(program.opts()).then(() =>
38-
console.log("Notion-pull Finished.")
38+
console.log("notion-pull-mdx Finished.")
3939
);

src/pull.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ let notionToMarkdown: NotionToMarkdown;
2828
const pages = new Array<NotionPage>();
2929

3030
export async function notionPull(options: any): Promise<void> {
31-
// It's helpful when troubleshooting CI secrets and environment variables to see what options actually made it to notion-pull.
31+
// It's helpful when troubleshooting CI secrets and environment variables to see what options actually made it to notion-pull-mdx.
3232
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
3333
const optionsForLogging = { ...options };
3434
// Just show the first few letters of the notion token, which start with "secret" anyhow.
@@ -101,7 +101,7 @@ async function getPagesRecursively(
101101
if (!rootLevel && pageInfo.hasParagraphs && pageInfo.childPages.length) {
102102
console.error(
103103
error(
104-
`Skipping "${pageInTheOutline.nameOrTitle}" and its children. Notion-pull does not support pages that are both levels and have content at the same time.`
104+
`Skipping "${pageInTheOutline.nameOrTitle}" and its children. notion-pull-mdx does not support pages that are both levels and have content at the same time.`
105105
)
106106
);
107107
return;

0 commit comments

Comments
 (0)