-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
More resilient image names #82
Comments
This is currently a major issue for the Scripture Forge help site. Unfortunately I don't have time now to address this, but I wanted to register the fact that we will benefit once this is addressed. |
@Nateowami |
@andrew-polk Originally I planned to have our site be built by running a script that would fetch all documents from Notion, Crowdin, and elsewhere, and build the site. None of the content would be checked in (no screenshots either). However, I realized before too long that this was kind of impractical and would make it difficult to understand what had actually changed. So I created a new repo, and content (docs and images) are checked in. Having the file names change every time we fetch them means new screenshots are created in the repo every time. Having the markdown change also added some challenges with updating Crowdin, since there were always changes to the files. I can't think of a good solution that doesn't involve keeping the file names consistent. |
Are the file names changing every time you run docu-notion? Or just when you change something with the image? With our and PTX setup, we only get changes if there are changes in Notion. If you see a change with every pull, we will need to figure out what is causing that. |
Yes, they change every time, even a few minutes later. I'm running it with |
Hm. Looks like npx is running docu-notion 0.11.0. |
I thought npx downloads the latest version of docu-notion and runs it. Does npx not work how I think? How do I tell it to use a particular version? |
Oh, it looks like I should be using |
Ah. That would do it. |
------------------ Breaking change: Previously, image files names were a hash of all or part of the image url. To provide more stability and future-proofing, the default format is now `{page-slug}.{notion-block-id}`. (#82) Users can opt in to the old format with `--image-file-name-format legacy`. ------------------ Feature: If desired instead, users can specify `--image-file-name-format content-hash` to use a hash of the image content as the file name. (#76) ------------------ Potential breaking change for plugins: The exported type IDocuNotionContext changed from ``` export type IDocuNotionContext = { layoutStrategy: LayoutStrategy; options: DocuNotionOptions; getBlockChildren: IGetBlockChildrenFn; notionToMarkdown: NotionToMarkdown; directoryContainingMarkdown: string; relativeFilePathToFolderContainingPage: string; convertNotionLinkToLocalDocusaurusLink: (url: string) => string | undefined; pages: NotionPage[]; counts: ICounts; imports: string[]; }; ``` to ``` export type IDocuNotionContext = { layoutStrategy: LayoutStrategy; options: DocuNotionOptions; getBlockChildren: IGetBlockChildrenFn; notionToMarkdown: NotionToMarkdown; pageInfo: IDocuNotionContextPageInfo; convertNotionLinkToLocalDocusaurusLink: (url: string) => string | undefined; pages: NotionPage[]; counts: ICounts; imports: string[]; }; ``` where `IDocuNotionContextPageInfo` is ``` export type IDocuNotionContextPageInfo = { directoryContainingMarkdown: string; relativeFilePathToFolderContainingPage: string; slug: string; }; ```
------------------ Breaking change: Previously, image files names were a hash of all or part of the image url. To provide more stability and future-proofing, the default format is now `{page-slug}.{notion-block-id}`. (#82) Users can opt in to the old format with `--image-file-name-format legacy`. ------------------ Feature: If desired instead, users can specify `--image-file-name-format content-hash` to use a hash of the image content as the file name. (#76) ------------------ Potential breaking change for plugins: The exported type IDocuNotionContext changed from ``` export type IDocuNotionContext = { layoutStrategy: LayoutStrategy; options: DocuNotionOptions; getBlockChildren: IGetBlockChildrenFn; notionToMarkdown: NotionToMarkdown; directoryContainingMarkdown: string; relativeFilePathToFolderContainingPage: string; convertNotionLinkToLocalDocusaurusLink: (url: string) => string | undefined; pages: NotionPage[]; counts: ICounts; imports: string[]; }; ``` to ``` export type IDocuNotionContext = { layoutStrategy: LayoutStrategy; options: DocuNotionOptions; getBlockChildren: IGetBlockChildrenFn; notionToMarkdown: NotionToMarkdown; pageInfo: IDocuNotionContextPageInfo; convertNotionLinkToLocalDocusaurusLink: (url: string) => string | undefined; pages: NotionPage[]; counts: ICounts; imports: string[]; }; ``` where `IDocuNotionContextPageInfo` is ``` export type IDocuNotionContextPageInfo = { directoryContainingMarkdown: string; relativeFilePathToFolderContainingPage: string; slug: string; }; ```
------------------ Breaking change: Previously, image files names were a hash of all or part of the image url. To provide more stability and future-proofing, the default format is now `{page-slug}.{notion-block-id}`. (#82) Users can opt in to the old format with `--image-file-name-format legacy`. ------------------ Feature: If desired instead, users can specify `--image-file-name-format content-hash` to use a hash of the image content as the file name. (#76) ------------------ Potential breaking change for plugins: The exported type IDocuNotionContext changed from ``` export type IDocuNotionContext = { layoutStrategy: LayoutStrategy; options: DocuNotionOptions; getBlockChildren: IGetBlockChildrenFn; notionToMarkdown: NotionToMarkdown; directoryContainingMarkdown: string; relativeFilePathToFolderContainingPage: string; convertNotionLinkToLocalDocusaurusLink: (url: string) => string | undefined; pages: NotionPage[]; counts: ICounts; imports: string[]; }; ``` to ``` export type IDocuNotionContext = { layoutStrategy: LayoutStrategy; options: DocuNotionOptions; getBlockChildren: IGetBlockChildrenFn; notionToMarkdown: NotionToMarkdown; pageInfo: IDocuNotionContextPageInfo; convertNotionLinkToLocalDocusaurusLink: (url: string) => string | undefined; pages: NotionPage[]; counts: ICounts; imports: string[]; }; ``` where `IDocuNotionContextPageInfo` is ``` export type IDocuNotionContextPageInfo = { directoryContainingMarkdown: string; relativeFilePathToFolderContainingPage: string; slug: string; }; ```
------------------ Breaking change: Previously, image files names were a hash of all or part of the image url. To provide more stability and future-proofing, the default format is now `{page-slug}.{notion-block-id}`. (#82) Users can opt in to the old format with `--image-file-name-format legacy`. ------------------ Feature: If desired instead, users can specify `--image-file-name-format content-hash` to use a hash of the image content as the file name. (#76) ------------------ Potential breaking change for plugins: The exported type IDocuNotionContext changed from ``` export type IDocuNotionContext = { layoutStrategy: LayoutStrategy; options: DocuNotionOptions; getBlockChildren: IGetBlockChildrenFn; notionToMarkdown: NotionToMarkdown; directoryContainingMarkdown: string; relativeFilePathToFolderContainingPage: string; convertNotionLinkToLocalDocusaurusLink: (url: string) => string | undefined; pages: NotionPage[]; counts: ICounts; imports: string[]; }; ``` to ``` export type IDocuNotionContext = { layoutStrategy: LayoutStrategy; options: DocuNotionOptions; getBlockChildren: IGetBlockChildrenFn; notionToMarkdown: NotionToMarkdown; pageInfo: IDocuNotionContextPageInfo; convertNotionLinkToLocalDocusaurusLink: (url: string) => string | undefined; pages: NotionPage[]; counts: ICounts; imports: string[]; }; ``` where `IDocuNotionContextPageInfo` is ``` export type IDocuNotionContextPageInfo = { directoryContainingMarkdown: string; relativeFilePathToFolderContainingPage: string; slug: string; }; ```
Default image file name template is now |
Currently, we extract an image name from the S3 URL that Notion uses. This name "matters" if you're doing image localization.
My concern is, what if Notion changes their URL scheme in a way that either a) requires a new regex to extract it (this has happened already once) or b) changes the id entirely?
Instead, we should use the id of the block, which is likely to be at least as stable, if not more-so, and doesn't require a regext to extract. here's a typical block with unnecessary stuff removed:
This is an easy fix, however it would break existing users, so we need a way to opt in or opt out of this change.
The text was updated successfully, but these errors were encountered: