File tree 2 files changed +8
-4
lines changed
2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import { HTMLProps } from "react";
5
5
import TableOfContentScrollEffect from "./TableOfContentScrollEffect" ;
6
6
import "highlight.js/styles/atom-one-dark.css" ;
7
7
import path from "path" ;
8
+
8
9
export default function Article ( params : HTMLProps < HTMLDivElement > & { markdown : string , markdownFilePath : string | null } ) {
9
10
const { markdown, className, markdownFilePath, ...restProps } = params ;
10
11
const headingsMapPoc = { } ;
@@ -78,10 +79,12 @@ export default function Article(params: HTMLProps<HTMLDivElement> & { markdown:
78
79
return str ;
79
80
} ;
80
81
renderer . image = ( href , title ) => {
81
- if ( markdownFilePath === null ) return `<img src="${ href } " title="${ title || '' } " />` ;
82
- const markdownDir = markdownFilePath . substring ( 0 , markdownFilePath . lastIndexOf ( '/' ) ) ;
83
- const resolvedPath = path . join ( path . relative ( 'blog/' , markdownDir ) , href ) ;
84
- return `<img src="${ resolvedPath } " title="${ title || '' } " />` ;
82
+
83
+ if ( markdownFilePath === null ) return `<img src="${ href } " title="${ title || "" } " />` ;
84
+
85
+ const markdownDir = markdownFilePath . substring ( 0 , markdownFilePath . lastIndexOf ( "/" ) ) ;
86
+ const resolvedPath = path . join ( path . relative ( "blog/" , markdownDir ) , href ) ;
87
+ return `<img src="${ resolvedPath } " title="${ title || "" } " />` ;
85
88
} ;
86
89
return renderer ;
87
90
}
Original file line number Diff line number Diff line change @@ -54,6 +54,7 @@ export async function getBlogArticles(): Promise<BlogArticle[]> {
54
54
if ( attributes . authors !== undefined && ! Array . isArray ( attributes . authors ) ) {
55
55
attributes . authors = [ attributes . authors ] ;
56
56
}
57
+
57
58
// blogPath relative to public
58
59
const blogPath = path . relative ( publicDir , articlePath ) . replace ( / \\ / g, "/" ) ;
59
60
You can’t perform that action at this time.
0 commit comments