From 62141f9693590f269e1e9f1723dae852791a20ae Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Wed, 25 Oct 2023 13:39:09 +0800 Subject: [PATCH] Fix relative doc link in HTML. --- feishu-pages/src/index.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/feishu-pages/src/index.ts b/feishu-pages/src/index.ts index c349ecc..7bc9a57 100644 --- a/feishu-pages/src/index.ts +++ b/feishu-pages/src/index.ts @@ -81,8 +81,10 @@ const fetchDocAndWriteFile = async ( // TODO: Replace link's node_token into slug for (const node_token in slugMap) { - const re = new RegExp(`\\]\\(${node_token}\\)`, 'gm'); - content = content.replace(re, `](${URL_PREFIX}${slugMap[node_token]})`); + // Replace Markdown link and HTML link + const re = new RegExp(`${node_token}`, 'gm'); + const newLink = `${URL_PREFIX}${slugMap[node_token]}`; + content = content.replace(re, newLink); } const metaInfo = generateFileMeta(doc, doc.slug, doc.position);