do sub-heading anchor links manually instead of via rehype plugin

This commit is contained in:
2022-01-22 17:21:29 -05:00
parent 7b01f01c9d
commit f62c057f5d
5 changed files with 132 additions and 303 deletions
-10
View File
@@ -13,7 +13,6 @@ import { NOTES_DIR, baseUrl } from "./config";
import remarkGfm from "remark-gfm";
import rehypeExternalLinks from "rehype-external-links";
import rehypeSlug from "rehype-slug";
import rehypeAutolinkHeadings from "rehype-autolink-headings";
// note: 'common' only exports these languages: https://github.com/wooorm/refractor/blob/main/lib/common.js
// eslint-disable-next-line import/no-unresolved
import rehypePrism from "rehype-prism-plus/common";
@@ -72,15 +71,6 @@ export const getNote = async (slug: string): Promise<NoteType> => {
rehypePlugins: [
[rehypeExternalLinks, { target: "_blank", rel: ["noopener", "noreferrer"] }],
[rehypeSlug, {}],
[
rehypeAutolinkHeadings,
{
behavior: "append",
properties: { className: "h-anchor", ariaHidden: true, tabIndex: -1 },
content: [],
test: ["h2", "h3"],
},
],
[rehypePrism, { ignoreMissing: true }],
],
},