From 445d877b77fdc8556761fc3d6fb079bf9eb5433f Mon Sep 17 00:00:00 2001 From: Francisco Moretti Date: Fri, 14 Apr 2023 20:50:00 +0100 Subject: [PATCH 1/2] Wrap heading text in anchor tag --- contentlayer.config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/contentlayer.config.js b/contentlayer.config.js index c871328..1e9878c 100644 --- a/contentlayer.config.js +++ b/contentlayer.config.js @@ -170,6 +170,7 @@ export default makeSource({ [ rehypeAutolinkHeadings, { + behavior: "wrap", properties: { className: ["subheading-anchor"], ariaLabel: "Link to section", From f1c17dfa3c1e295ff8317322b51ca352443ba669 Mon Sep 17 00:00:00 2001 From: Francisco Moretti Date: Sat, 15 Apr 2023 11:06:50 +0100 Subject: [PATCH 2/2] bugfix: inexistent subheading-anchor class --- contentlayer.config.js | 2 +- tailwind.config.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/contentlayer.config.js b/contentlayer.config.js index 1e9878c..543c3f9 100644 --- a/contentlayer.config.js +++ b/contentlayer.config.js @@ -172,7 +172,7 @@ export default makeSource({ { behavior: "wrap", properties: { - className: ["subheading-anchor"], + className: ["before:content-['#'] before:absolute before:invisible before:-ml-[1em] hover:before:visible before:text-slate-300 pl-[1em] -ml-[1em]"], ariaLabel: "Link to section", }, }, diff --git a/tailwind.config.js b/tailwind.config.js index 2780d85..112d561 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -8,6 +8,7 @@ module.exports = { "./components/**/*.{ts,tsx}", "./ui/**/*.{ts,tsx}", "./content/**/*.{md,mdx}", + "contentlayer.config.js", ], darkMode: ["class"], theme: {