Skip to content

Commit cb86e3c

Browse files
committed
container element now customizable + optional
1 parent d2c761c commit cb86e3c

File tree

6 files changed

+892
-32
lines changed

6 files changed

+892
-32
lines changed

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,9 @@ the output will look like this:
9292

9393
`options` (optional)
9494

95-
`options.mdx` (`boolean`, default: true)
95+
* `options.mdx` (`boolean`, default: true) if you use mdx-js leave it to true, if you use markdown set it to false
96+
* `options.containerTagName` (`string`, default: 'aside') chose an element for the container that is around the toc, can by any html element you want, a `div`, a `section` ...
97+
* `options.hasContainer` (`boolean`, default: true) by default the toc is in a container, set to false to not use a container
9698

9799
let's the plugin know if you are using mdx (mdx:true) or markdown (mdx: false)
98100

@@ -107,3 +109,8 @@ this plugin uses [mdast-util-toc](https://github.com/syntax-tree/mdast-util-toc)
107109
* `tight` (`boolean`, default: `false`) whether to compile list items tightly
108110
* `ordered` (`boolean`, default: `false`) whether to compile list items as an ordered list, otherwise they are unordered
109111
* `prefix` (`string`, optional) add a prefix to links to headings in the table of contents. Useful for example when later going from mdast to hast and sanitizing with `hast-util-sanitize`.
112+
113+
## TODOs
114+
115+
* add a nav element around the toc, make it optional
116+
* make the placeholder string customizable so that it can be changed to whatever string the dev wants to use

dist/index.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import type { Plugin } from 'unified';
22
import { Options } from 'mdast-util-toc';
33
export interface IRemarkTableOfContentsOptions extends Options {
44
mdx?: boolean;
5+
containerTagName?: string;
6+
hasContainer?: boolean;
57
}
68
declare const remarkTableOfContents: Plugin;
79
export { remarkTableOfContents };

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)