From d1386bba32e1c34feebc4d0375532484207c5414 Mon Sep 17 00:00:00 2001 From: Petyo Ivanov Date: Tue, 6 Feb 2024 08:27:27 +0200 Subject: [PATCH] Fix api ref links --- app/editor/api/[[...slug]]/page.tsx | 7 ++++++- app/globals.css | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/app/editor/api/[[...slug]]/page.tsx b/app/editor/api/[[...slug]]/page.tsx index 73db607..b7bbb26 100644 --- a/app/editor/api/[[...slug]]/page.tsx +++ b/app/editor/api/[[...slug]]/page.tsx @@ -83,7 +83,12 @@ export default function Page({ params }: { params: PageParams }) { if (node.type == 'element' && node.tagName === 'a') { let href = node.properties!.href as string href = href.replace(/\.md$/, '').replace('README.md', '') - node.properties!.href = `/editor/api/${href}` + + // relative links are ok + if (!href.startsWith('..')) { + href = `/editor/api/${href}` + } + node.properties!.href = href } }, }, diff --git a/app/globals.css b/app/globals.css index 0b57621..1d76685 100644 --- a/app/globals.css +++ b/app/globals.css @@ -212,6 +212,11 @@ @apply mb-4; } } + + a > code { + text-decoration: none; + border-bottom: 1px dotted var(--blue9); + } } .full-demo-mdxeditor [role=toolbar] {