From bdd36c7316f4ce4d0860a868d7efb04fcf8bf332 Mon Sep 17 00:00:00 2001 From: Kuinox Date: Wed, 9 Oct 2024 11:39:52 +0200 Subject: [PATCH] Lint fix --- src/components/Article.tsx | 11 +++++++---- src/utils/blog.ts | 1 + 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/components/Article.tsx b/src/components/Article.tsx index 584a3f1..ca02874 100644 --- a/src/components/Article.tsx +++ b/src/components/Article.tsx @@ -5,6 +5,7 @@ import { HTMLProps } from "react"; import TableOfContentScrollEffect from "./TableOfContentScrollEffect"; import "highlight.js/styles/atom-one-dark.css"; import path from "path"; + export default function Article(params: HTMLProps & { markdown: string, markdownFilePath: string|null}) { const { markdown, className, markdownFilePath, ...restProps } = params; const headingsMapPoc = {}; @@ -78,10 +79,12 @@ export default function Article(params: HTMLProps & { markdown: return str; }; renderer.image = (href, title) => { - if (markdownFilePath === null) return ``; - const markdownDir = markdownFilePath.substring(0, markdownFilePath.lastIndexOf('/')); - const resolvedPath = path.join(path.relative('blog/', markdownDir),href); - return ``; + + if (markdownFilePath === null) return ``; + + const markdownDir = markdownFilePath.substring(0, markdownFilePath.lastIndexOf("/")); + const resolvedPath = path.join(path.relative("blog/", markdownDir),href); + return ``; }; return renderer; } diff --git a/src/utils/blog.ts b/src/utils/blog.ts index 35945f3..f0a0c96 100644 --- a/src/utils/blog.ts +++ b/src/utils/blog.ts @@ -54,6 +54,7 @@ export async function getBlogArticles(): Promise { if (attributes.authors !== undefined && !Array.isArray(attributes.authors)) { attributes.authors = [attributes.authors]; } + // blogPath relative to public const blogPath = path.relative(publicDir, articlePath).replace(/\\/g, "/");