diff --git a/src/components/Markdown/Markdawn.tsx b/src/components/Markdown/Markdawn.tsx
index 6414a1e..54feaf5 100644
--- a/src/components/Markdown/Markdawn.tsx
+++ b/src/components/Markdown/Markdawn.tsx
@@ -21,6 +21,30 @@ export default function Markdawn(props: ScenBreakProps): JSX.Element {
options={{
slugify: slugify,
overrides: {
+ h2: {
+ component: (props: { id: string; children: React.ReactNode }) => {
+ return (
+
+
{props.children}
+
+ {
+ navigator.clipboard.writeText(
+ process.env.NEXT_PUBLIC_URL_SELF +
+ window.location.pathname +
+ "#" +
+ props.id
+ );
+ }}
+ >
+ link
+
+
+
+ );
+ },
+ },
Sep: {
component: () => {
return ;
diff --git a/src/components/Markdown/TOC.tsx b/src/components/Markdown/TOC.tsx
index ff0c15f..b963ee1 100644
--- a/src/components/Markdown/TOC.tsx
+++ b/src/components/Markdown/TOC.tsx
@@ -1,20 +1,23 @@
+import { NextRouter } from "next/router";
import { slugify } from "queries/helpers";
import { preprocessMarkDawn } from "./Markdawn";
type TOCProps = {
text: string;
title?: string;
+ router: NextRouter;
};
export default function TOC(props: TOCProps): JSX.Element {
- const toc = getTocFromMarkdawn(preprocessMarkDawn(props.text), props.title);
+ const { router, text, title } = props;
+ const toc = getTocFromMarkdawn(preprocessMarkDawn(text), title);
return (
Table of content
-
-
+ router.replace(`#${toc.slug}`)}>
{{toc.title}}
@@ -25,7 +28,7 @@ export default function TOC(props: TOCProps): JSX.Element {
className="my-2 overflow-x-hidden w-full text-ellipsis whitespace-nowrap"
>
{`${h2Index + 1}. `}
-
+ router.replace(`#${h2.slug}`)}>
{{h2.title}}
@@ -38,7 +41,7 @@ export default function TOC(props: TOCProps): JSX.Element {
{`${h2Index + 1}.${
h3Index + 1
}. `}
-
+ router.replace(`#${h3.slug}`)}>
{{h3.title}}
diff --git a/src/pages/contents/[slug]/read.tsx b/src/pages/contents/[slug]/read.tsx
index 622bc39..68cf596 100644
--- a/src/pages/contents/[slug]/read.tsx
+++ b/src/pages/contents/[slug]/read.tsx
@@ -148,6 +148,7 @@ export default function ContentRead(props: ContentReadProps): JSX.Element {
0
? prettyinlineTitle(
diff --git a/src/tailwind.css b/src/tailwind.css
index a17a243..7f30142 100644
--- a/src/tailwind.css
+++ b/src/tailwind.css
@@ -17,7 +17,7 @@
}
a {
- @apply transition-colors underline-offset-2 decoration-dotted underline decoration-dark hover:text-dark;
+ @apply transition-colors underline-offset-2 decoration-dotted underline decoration-dark hover:text-dark cursor-pointer;
}
*::selection {