Skip to content

Commit a6c2791

Browse files
authored
Lint fix (#32)
1 parent 80fc1c6 commit a6c2791

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/components/Article.tsx

+7-4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { HTMLProps } from "react";
55
import TableOfContentScrollEffect from "./TableOfContentScrollEffect";
66
import "highlight.js/styles/atom-one-dark.css";
77
import path from "path";
8+
89
export default function Article(params: HTMLProps<HTMLDivElement> & { markdown: string, markdownFilePath: string|null}) {
910
const { markdown, className, markdownFilePath, ...restProps } = params;
1011
const headingsMapPoc = {};
@@ -78,10 +79,12 @@ export default function Article(params: HTMLProps<HTMLDivElement> & { markdown:
7879
return str;
7980
};
8081
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 || ""}" />`;
8588
};
8689
return renderer;
8790
}

src/utils/blog.ts

+1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ export async function getBlogArticles(): Promise<BlogArticle[]> {
5454
if (attributes.authors !== undefined && !Array.isArray(attributes.authors)) {
5555
attributes.authors = [attributes.authors];
5656
}
57+
5758
// blogPath relative to public
5859
const blogPath = path.relative(publicDir, articlePath).replace(/\\/g, "/");
5960

0 commit comments

Comments
 (0)