You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -81,6 +81,8 @@ notion-pull-mdx makes some attempt to keep the right order of things, but there
81
81
82
82
Localize your files in Crowdin (or whatever) based on the markdown files, not in Notion. For how to do this with Docusaurus, see [Docusaurus i18n](https://docusaurus.io/docs/i18n/crowdin).
83
83
84
+
You may also need to localize screenshots. Crowdin can also handle localizing assets, but this library currently supports a different approach. If you place for example `fr https:\\imgur.com\1234.png` in the caption of a screenshot in Notion, `notion-pull-mdx` will fetch that image and save it locally with the same name as the primary screenshot, but with "-fr" appended. So you'd get for example `static\img\9876.png` and `static\img\9876-fr.png`. To get the French version to show, you'd need to add that "-fr" to the markdown link when you localize the page's text in crowdin. If there is a way, maybe this modification of the markdown can be made automatic in the future so that you automatically get the right image version.
85
+
84
86
# Automated builds with Github Actions
85
87
86
88
Here is a working Github Action script to copy and customize: https://github.com/BloomBooks/bloom-docs/blob/master/.github/workflows/release.yml
`Something wrong with the filetype extension on the blob we got from ${url}`
68
+
`Something wrong with the filetype extension on the blob we got from ${imageSet.primaryUrl}`
57
69
);
58
70
return"error";
59
71
}
60
72
}
73
+
functionwriteImageIfNew(
74
+
imageFolderPath: string,
75
+
outputFileName: string,
76
+
buffer: Buffer
77
+
){
78
+
constpath=imageFolderPath+"/"+outputFileName;
79
+
imageWasSeen(path);
80
+
if(!fs.pathExistsSync(path)){
81
+
console.log("Adding image "+path);
82
+
fs.createWriteStream(path).write(buffer);// async but we're not waiting
83
+
}
84
+
returnoutputFileName;
85
+
}
86
+
61
87
functionhashOfString(s: string){
62
88
lethash=0;
63
89
for(leti=0;i<s.length;++i)
@@ -66,33 +92,58 @@ function hashOfString(s: string) {
66
92
returnMath.abs(hash);
67
93
}
68
94
69
-
typeLocalizableImageWithCaption={
70
-
url: string;
95
+
// we parse a notion image and its caption into what we need, which includes any urls to localized versions of the image that may be embedded in the caption
img.url=b.image.file.url;// image saved on notion (actually AWS)
109
+
imageSet.primaryUrl=b.image.file.url;// image saved on notion (actually AWS)
82
110
}else{
83
-
img.url=b.image.external.url;// image still pointing somewhere else. I've see this happen when copying a Google Doc into Notion. Notion kep pointing at the google doc.
111
+
imageSet.primaryUrl=b.image.external.url;// image still pointing somewhere else. I've see this happen when copying a Google Doc into Notion. Notion kep pointing at the google doc.
0 commit comments