From 18a08efa6a1c22958564d8a8007b78ad51554acc Mon Sep 17 00:00:00 2001 From: moris Date: Thu, 6 Mar 2025 11:59:38 +0900 Subject: [PATCH] =?UTF-8?q?rehype-header-links=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bun.lock | 3 +++ package.json | 1 + src/lib/components/Markdown.css | 2 +- src/lib/components/Markdown.ts | 2 ++ 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/bun.lock b/bun.lock index c05360f..80716fe 100644 --- a/bun.lock +++ b/bun.lock @@ -4,6 +4,7 @@ "": { "dependencies": { "@twemoji/parser": "^15.1.1", + "rehype-header-links": "git+https://git.moris.day/moris/rehype-header-links.git", "github-slugger": "^2.0.0", "mdast-util-to-string": "^4.0.0", "rehype-external-links": "^3.0.0", @@ -387,6 +388,8 @@ "rehype-github-alert": ["rehype-github-alert@1.0.0", "", { "dependencies": { "@types/hast": "^3.0.0", "hast-util-whitespace": "^3.0.0", "unist-util-visit": "^5.0.0" } }, "sha512-Ijn6RGfqQTcqEvB4C7qfpk85NhVA7tncuUH8sncM45xrtuvlEt3Z9OHwoCZ8a/8wpXwfBDn9xorCVihLHg2O1w=="], + "rehype-header-links": ["rehype-header-links@git+https://git.moris.day/moris/rehype-header-links.git#18d1c952950c9ad87746e227aeeb670dae2a09c1", { "dependencies": { "@types/hast": "^3.0", "unist-util-visit-parents": "^6.0" }, "peerDependencies": { "typescript": "^5" } }, "18d1c952950c9ad87746e227aeeb670dae2a09c1"], + "rehype-highlight": ["rehype-highlight@7.0.1", "", { "dependencies": { "@types/hast": "^3.0.0", "hast-util-to-text": "^4.0.0", "lowlight": "^3.0.0", "unist-util-visit": "^5.0.0", "vfile": "^6.0.0" } }, "sha512-dB/vVGFsbm7xPglqnYbg0ABg6rAuIWKycTvuXaOO27SgLoOFNoTlniTBtAxp3n5ZyMioW1a3KwiNqgjkb6Skjg=="], "rehype-katex": ["rehype-katex@7.0.1", "", { "dependencies": { "@types/hast": "^3.0.0", "@types/katex": "^0.16.0", "hast-util-from-html-isomorphic": "^2.0.0", "hast-util-to-text": "^4.0.0", "katex": "^0.16.0", "unist-util-visit-parents": "^6.0.0", "vfile": "^6.0.0" } }, "sha512-OiM2wrZ/wuhKkigASodFoo8wimG3H12LWQaH8qSPVJn9apWKFSH3YOCtbKpBorTVw/eI7cuT21XBbvwEswbIOA=="], diff --git a/package.json b/package.json index bb2ae62..612ea9f 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,7 @@ "mdast-util-to-string": "^4.0.0", "rehype-external-links": "^3.0.0", "rehype-github-alert": "^1.0.0", + "rehype-header-links": "git+https://git.moris.day/moris/rehype-header-links.git", "rehype-highlight": "^7.0.1", "rehype-katex": "^7.0.1", "rehype-slug": "^6.0.0", diff --git a/src/lib/components/Markdown.css b/src/lib/components/Markdown.css index d27b8b2..cedde41 100644 --- a/src/lib/components/Markdown.css +++ b/src/lib/components/Markdown.css @@ -245,7 +245,7 @@ } } - & .marker { + & .marker a{ text-decoration: line-through; text-decoration-thickness: 1.125em; diff --git a/src/lib/components/Markdown.ts b/src/lib/components/Markdown.ts index 37680c3..bf2396d 100644 --- a/src/lib/components/Markdown.ts +++ b/src/lib/components/Markdown.ts @@ -11,6 +11,7 @@ import rehypeHighlight from 'rehype-highlight' import rehypeExternalLinks from 'rehype-external-links' import rehypeGithubAlert from 'rehype-github-alert' import rehypeStringify from 'rehype-stringify' +import rehypeHeaderLinks from 'rehype-header-links' function Perser(mdtext: string): string { @@ -24,6 +25,7 @@ function Perser(mdtext: string): string { .use(rehypeHighlight) // Syntax highlight .use(rehypeExternalLinks, {target:'_blank', rel:['noreferrer','noopener']}) // 外部サイトを新規タブで開く .use(rehypeGithubAlert) + .use(rehypeHeaderLinks, {style: {color:'inherit'}}) .use(rehypeStringify, {allowDangerousHtml: true}) .processSync(mdtext) .toString()