Skip to content

Commit 076771e

Browse files
authored
support async transform in Next.js plugin (#13)
1 parent 35f015b commit 076771e

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"typescript": "4.6.2"
2828
},
2929
"peerDependencies": {
30-
"@markdoc/markdoc": "^0.1.1",
30+
"@markdoc/markdoc": "^0.1.4",
3131
"next": "*",
3232
"react": "*"
3333
},

src/loader.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ export async function ${dataFetchingFunction}(context) {
218218
* transform must be called in dataFetchingFunction to support server-side rendering while
219219
* accessing variables on the server
220220
*/
221-
const content = Markdoc.transform(ast, cfg);
221+
const content = await Markdoc.transform(ast, cfg);
222222
223223
return {
224224
// Removes undefined

tests/__snapshots__/index.test.js.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export async function getStaticProps(context) {
5555
* transform must be called in dataFetchingFunction to support server-side rendering while
5656
* accessing variables on the server
5757
*/
58-
const content = Markdoc.transform(ast, cfg);
58+
const content = await Markdoc.transform(ast, cfg);
5959
6060
return {
6161
// Removes undefined
@@ -141,7 +141,7 @@ export async function getStaticProps(context) {
141141
* transform must be called in dataFetchingFunction to support server-side rendering while
142142
* accessing variables on the server
143143
*/
144-
const content = Markdoc.transform(ast, cfg);
144+
const content = await Markdoc.transform(ast, cfg);
145145
146146
return {
147147
// Removes undefined

0 commit comments

Comments
 (0)