Skip to content

Commit

Permalink
Lint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Kuinox committed Oct 9, 2024
1 parent 80fc1c6 commit bdd36c7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/components/Article.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<HTMLDivElement> & { markdown: string, markdownFilePath: string|null}) {
const { markdown, className, markdownFilePath, ...restProps } = params;
const headingsMapPoc = {};
Expand Down Expand Up @@ -78,10 +79,12 @@ export default function Article(params: HTMLProps<HTMLDivElement> & { markdown:
return str;
};
renderer.image = (href, title) => {
if (markdownFilePath === null) return `<img src="${href}" title="${title || ''}" />`;
const markdownDir = markdownFilePath.substring(0, markdownFilePath.lastIndexOf('/'));
const resolvedPath = path.join(path.relative('blog/', markdownDir),href);
return `<img src="${resolvedPath}" title="${title || ''}" />`;

if (markdownFilePath === null) return `<img src="${href}" title="${title || ""}" />`;

const markdownDir = markdownFilePath.substring(0, markdownFilePath.lastIndexOf("/"));
const resolvedPath = path.join(path.relative("blog/", markdownDir),href);
return `<img src="${resolvedPath}" title="${title || ""}" />`;
};
return renderer;
}
Expand Down
1 change: 1 addition & 0 deletions src/utils/blog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export async function getBlogArticles(): Promise<BlogArticle[]> {
if (attributes.authors !== undefined && !Array.isArray(attributes.authors)) {
attributes.authors = [attributes.authors];
}

// blogPath relative to public
const blogPath = path.relative(publicDir, articlePath).replace(/\\/g, "/");

Expand Down

0 comments on commit bdd36c7

Please sign in to comment.