3.0.2 • Published 8 months ago
@altano/remark-mdx-toc-with-slugs v3.0.2
remark-mdx-toc-with-slugs
Summary
This is a remark plugin that exports a table of contents. It is similar to the @altano/remark-mdx-toc plugin but has an additional slug property.
Given this mdx:
## Resource Acquisition Is Initialization (RAII)
### Is There a Problem?
### C++ Classes
### The Solutionremark-mdx-toc-with-slugs exports this object on the toc field:
export const toc = [
{
depth: 2,
value: "Resource Acquisition Is Initialization (RAII)",
slug: "resource-acquisition-is-initialization-raii",
attributes: {},
children: [
{
depth: 3,
value: "Is There a Problem?",
attributes: {},
children: [],
slug: "is-there-a-problem",
},
{
depth: 3,
value: "C++ Classes",
attributes: {},
children: [],
slug: "c-classes",
},
{
depth: 3,
value: "The Solution",
attributes: {},
children: [],
slug: "the-solution",
},
],
},
];Options
name: The exported variable name of the table of contents. By default, it'stoc.
Misc
- If you don't need the slug, consider using @altano/remark-mdx-toc.
- Slugs are generated using
github-sluggerand should therefore match therehype-slugpackage