Skip to content

Commit

Permalink
fix(be): fix the issue with not to be converted into slugified link w…
Browse files Browse the repository at this point in the history
…here referenced markdown file link exists in the markdown file
  • Loading branch information
gyunseo committed Apr 27, 2024
1 parent b9d912c commit 93409af
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/utils/updateMarkdownASTNodeURLValue.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { visit } from "unist-util-visit";
import { slugifyStr } from "./slugify";

export const remarkMathDebug = () => {
return (tree: any) => {
Expand Down Expand Up @@ -42,7 +43,8 @@ export const updateLinkNode = () => {
visit(tree, "link", node => {
// if url matches link regex, them trim the .md extension
if (node.url.match(/^.*\.(md)$/gi)) {
node.url = `/posts/${node.url.replace(/\.md$/gi, "")}`;
const dotMDTrimmedURL = node.url.replace(/\.md$/gi, "");
node.url = `/posts/${slugifyStr(dotMDTrimmedURL)}`;
}
});
};
Expand Down

0 comments on commit 93409af

Please sign in to comment.