File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed
Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change 11import { NotionPage } from "../NotionPage" ;
2+ import { error } from "../log" ;
23import { makeSamplePageObject , oneBlockToMarkdown } from "./pluginTestRun" ;
34import { IDocuNotionContext , IPlugin } from "./pluginTypes" ;
45
@@ -50,8 +51,13 @@ test("raw url inside a mermaid codeblock gets converted to path using slug of th
5051 const url = match [ 1 ] ;
5152 const docusaurusUrl =
5253 context . convertNotionLinkToLocalDocusaurusLink ( url ) ;
53- // eslint-disable-next-line @typescript-eslint/await-thenable
54- return await match [ 0 ] . replace ( url , docusaurusUrl ) ;
54+ if ( docusaurusUrl ) {
55+ // eslint-disable-next-line @typescript-eslint/await-thenable
56+ return await match [ 0 ] . replace ( url , docusaurusUrl ) ;
57+ } else {
58+ error ( `Could not convert link ${ url } to a local docusaurus link` ) ;
59+ return match [ 0 ] ;
60+ }
5561 } ,
5662 } ,
5763 ] ,
Original file line number Diff line number Diff line change @@ -71,7 +71,7 @@ export type IDocuNotionContext = {
7171 notionToMarkdown : NotionToMarkdown ;
7272 directoryContainingMarkdown : string ;
7373 relativeFilePathToFolderContainingPage : string ;
74- convertNotionLinkToLocalDocusaurusLink : ( url : string ) => string ;
74+ convertNotionLinkToLocalDocusaurusLink : ( url : string ) => string | undefined ;
7575 pages : NotionPage [ ] ;
7676 counts : ICounts ;
7777} ;
You can’t perform that action at this time.
0 commit comments