@altano/remark-mdx-toc-with-slugs
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

remark-mdx-toc-with-slugs

Summary

This is a remark plugin that exports a table of contents. It is similar to the 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 Solution

remark-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's toc.

Misc

Package Sidebar

Install

npm i @altano/remark-mdx-toc-with-slugs

Weekly Downloads

4

Version

2.0.0

License

ISC

Unpacked Size

6.44 kB

Total Files

4

Last publish

Collaborators

  • altano