remark-flexible-toc 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2023 ipikuka
3
+ Copyright (c) 2025 ipikuka
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,16 +1,16 @@
1
1
  # remark-flexible-toc
2
2
 
3
- [![NPM version][badge-npm-version]][npm-package-url]
4
- [![NPM downloads][badge-npm-download]][npm-package-url]
5
- [![Build][badge-build]][github-workflow-url]
6
- [![codecov](https://codecov.io/gh/ipikuka/remark-flexible-toc/graph/badge.svg?token=QBNX6L8W2G)](https://codecov.io/gh/ipikuka/remark-flexible-toc)
7
- [![type-coverage](https://img.shields.io/badge/dynamic/json.svg?label=type-coverage&prefix=%E2%89%A5&suffix=%&query=$.typeCoverage.atLeast&uri=https%3A%2F%2Fraw.githubusercontent.com%2Fipikuka%2Fremark-flexible-toc%2Fmaster%2Fpackage.json)](https://github.com/ipikuka/remark-flexible-toc)
8
- [![typescript][badge-typescript]][typescript-url]
9
- [![License][badge-license]][github-license-url]
3
+ [![npm version][badge-npm-version]][url-npm-package]
4
+ [![npm downloads][badge-npm-download]][url-npm-package]
5
+ [![publish to npm][badge-publish-to-npm]][url-publish-github-actions]
6
+ [![code-coverage][badge-codecov]][url-codecov]
7
+ [![type-coverage][badge-type-coverage]][url-github-package]
8
+ [![typescript][badge-typescript]][url-typescript]
9
+ [![license][badge-license]][url-license]
10
10
 
11
- This package is a [unified][unified] ([remark][remark]) plugin to expose the table of contents via `Vfile.data` or via an option reference in markdown.
11
+ This package is a [**unified**][unified] ([**remark**][remark]) plugin **to expose the table of contents via `Vfile.data` or via an option reference in markdown.**
12
12
 
13
- **[unified][unified]** is a project that transforms content with abstract syntax trees (ASTs) using the new parser **[micromark][micromark]**. **[remark][remark]** adds support for markdown to unified. **[mdast][mdast]** is the Markdown Abstract Syntax Tree (AST) which is a specification for representing markdown in a syntax tree.
13
+ [**unified**][unified] is a project that transforms content with abstract syntax trees (ASTs) using the new parser [**micromark**][micromark]. [**remark**][remark] adds support for markdown to unified. [**mdast**][mdast] is the Markdown Abstract Syntax Tree (AST) which is a specification for representing markdown in a syntax tree.
14
14
 
15
15
  **This plugin is a remark plugin that doesn't transform the mdast but gets info from the mdast.**
16
16
 
@@ -264,7 +264,7 @@ type TocItem = {
264
264
  > [!NOTE]
265
265
  > If there is a remark plugin before the `remark-flexible-toc` in the plugin chain, which provides custom id for headings like `remark-heading-id`, that custom id takes precedence for `href`.
266
266
 
267
- The `remark-flexible-toc` uses the `github-slugger` internally for producing unique links. Then, it is possible you to use [`rehype-slug`](https://github.com/rehypejs/rehype-slug) (forIDs on headings) and [`rehype-autolink-headings`](https://github.com/rehypejs/rehype-autolink-headings) (for anchors that link-to-self) because they use the same `github-slugger`.
267
+ The `remark-flexible-toc` uses the `github-slugger` internally for producing unique links. Then, it is possible you to use [**rehype-slug**][rehype-slug] (forIDs on headings) and [**rehype-autolink-headings**][rehype-autolink-headings] (for anchors that link-to-self) because they use the same `github-slugger`.
268
268
 
269
269
  As an example for the unique heading links (notice the same heading texts).
270
270
 
@@ -352,9 +352,7 @@ This plugin does not modify the `mdast` (markdown abstract syntax tree), collect
352
352
 
353
353
  ## Types
354
354
 
355
- This package is fully typed with [TypeScript][typescript].
356
-
357
- The plugin exports the types `FlexibleTocOptions`, `HeadingParent`, `HeadingDepth`, `TocItem`.
355
+ This package is fully typed with [TypeScript][url-typescript]. The plugin exports the types `FlexibleTocOptions`, `HeadingParent`, `HeadingDepth`, `TocItem`.
358
356
 
359
357
  ## Compatibility
360
358
 
@@ -389,6 +387,12 @@ I like to contribute the Unified / Remark / MDX ecosystem, so I recommend you to
389
387
 
390
388
  - [`rehype-pre-language`](https://www.npmjs.com/package/rehype-pre-language)
391
389
  – Rehype plugin to add language information as a property to `pre` element
390
+ - [`rehype-highlight-code-lines`](https://www.npmjs.com/package/rehype-highlight-code-lines)
391
+ – Rehype plugin to add line numbers to code blocks and allow highlighting of desired code lines
392
+ - [`rehype-code-meta`](https://www.npmjs.com/package/rehype-code-meta)
393
+ – Rehype plugin to copy `code.data.meta` to `code.properties.metastring`
394
+ - [`rehype-image-toolkit`](https://www.npmjs.com/package/rehype-image-toolkit)
395
+ – Rehype plugin to enhance Markdown image syntax `![]()` and Markdown/MDX media elements (`<img>`, `<audio>`, `<video>`) by auto-linking bracketed or parenthesized image URLs, wrapping them in `<figure>` with optional captions, unwrapping images/videos/audio from paragraph, parsing directives in title for styling and adding attributes, and dynamically converting images into `<video>` or `<audio>` elements based on file extension.
392
396
 
393
397
  ### My Recma Plugins
394
398
 
@@ -396,41 +400,44 @@ I like to contribute the Unified / Remark / MDX ecosystem, so I recommend you to
396
400
  – Recma plugin to set the default value `() => null` for the Components in MDX in case of missing or not provided so as not to throw an error
397
401
  - [`recma-mdx-change-props`](https://www.npmjs.com/package/recma-mdx-change-props)
398
402
  – Recma plugin to change the `props` parameter into the `_props` in the `function _createMdxContent(props) {/* */}` in the compiled source in order to be able to use `{props.foo}` like expressions. It is useful for the `next-mdx-remote` or `next-mdx-remote-client` users in `nextjs` applications.
403
+ - [`recma-mdx-change-imports`](https://www.npmjs.com/package/recma-mdx-change-imports)
404
+ – Recma plugin to convert import declarations for assets and media with relative links into variable declarations with string URLs, enabling direct asset URL resolution in compiled MDX.
405
+ - [`recma-mdx-import-media`](https://www.npmjs.com/package/recma-mdx-import-media)
406
+ – Recma plugin to turn media relative paths into import declarations for both markdown and html syntax in MDX.
407
+ - [`recma-mdx-import-react`](https://www.npmjs.com/package/recma-mdx-import-react)
408
+ – Recma plugin to ensure getting `React` instance from the arguments and to make the runtime props `{React, jsx, jsxs, jsxDev, Fragment}` is available in the dynamically imported components in the compiled source of MDX.
409
+ - [`recma-mdx-html-override`](https://www.npmjs.com/package/recma-mdx-html-override)
410
+ – Recma plugin to allow selected raw HTML elements to be overridden via MDX components.
411
+ - [`recma-mdx-interpolate`](https://www.npmjs.com/package/recma-mdx-interpolate)
412
+ – Recma plugin to enable interpolation of identifiers wrapped in curly braces within the `alt`, `src`, `href`, and `title` attributes of markdown link and image syntax in MDX.
399
413
 
400
414
  ## License
401
415
 
402
416
  [MIT License](./LICENSE) © ipikuka
403
417
 
404
- ### Keywords
405
-
406
- 🟩 [unified][unifiednpm] 🟩 [remark][remarknpm] 🟩 [remark plugin][remarkpluginnpm] 🟩 [mdast][mdastnpm] 🟩 [markdown][markdownnpm] 🟩 [mdx][mdxnpm] 🟩 [remark toc][remarktocnpm] 🟩 [remark table of contents][remarktableofcontentsnpm]
407
-
408
-
409
- [unifiednpm]: https://www.npmjs.com/search?q=keywords:unified
410
- [remarknpm]: https://www.npmjs.com/search?q=keywords:remark
411
- [remarkpluginnpm]: https://www.npmjs.com/search?q=keywords:remark%20plugin
412
- [mdastnpm]: https://www.npmjs.com/search?q=keywords:mdast
413
- [markdownnpm]: https://www.npmjs.com/search?q=keywords:markdown
414
- [mdxnpm]: https://www.npmjs.com/search?q=keywords:mdx
415
- [remarktocnpm]: https://www.npmjs.com/search?q=keywords:remark%20toc
416
- [remarktableofcontentsnpm]: https://www.npmjs.com/search?q=keywords:remark%20table%20of%20contents
417
-
418
418
  [unified]: https://github.com/unifiedjs/unified
419
+ [micromark]: https://github.com/micromark/micromark
419
420
  [remark]: https://github.com/remarkjs/remark
420
421
  [remarkplugins]: https://github.com/remarkjs/remark/blob/main/doc/plugins.md
421
422
  [mdast]: https://github.com/syntax-tree/mdast
422
- [micromark]: https://github.com/micromark/micromark
423
- [typescript]: https://www.typescriptlang.org/
423
+ [rehype-slug]: https://github.com/rehypejs/rehype-slug
424
+ [rehype-autolink-headings]: https://github.com/rehypejs/rehype-autolink-headings
424
425
 
425
426
  [badge-npm-version]: https://img.shields.io/npm/v/remark-flexible-toc
426
427
  [badge-npm-download]:https://img.shields.io/npm/dt/remark-flexible-toc
427
- [npm-package-url]: https://www.npmjs.com/package/remark-flexible-toc
428
+ [url-npm-package]: https://www.npmjs.com/package/remark-flexible-toc
429
+ [url-github-package]: https://github.com/ipikuka/remark-flexible-toc
428
430
 
429
431
  [badge-license]: https://img.shields.io/github/license/ipikuka/remark-flexible-toc
430
- [github-license-url]: https://github.com/ipikuka/remark-flexible-toc/blob/main/LICENSE
432
+ [url-license]: https://github.com/ipikuka/remark-flexible-toc/blob/main/LICENSE
431
433
 
432
- [badge-build]: https://github.com/ipikuka/remark-flexible-toc/actions/workflows/publish.yml/badge.svg
433
- [github-workflow-url]: https://github.com/ipikuka/remark-flexible-toc/actions/workflows/publish.yml
434
+ [badge-publish-to-npm]: https://github.com/ipikuka/remark-flexible-toc/actions/workflows/publish.yml/badge.svg
435
+ [url-publish-github-actions]: https://github.com/ipikuka/remark-flexible-toc/actions/workflows/publish.yml
434
436
 
435
437
  [badge-typescript]: https://img.shields.io/npm/types/remark-flexible-toc
436
- [typescript-url]: https://www.typescriptlang.org/
438
+ [url-typescript]: https://www.typescriptlang.org/
439
+
440
+ [badge-codecov]: https://codecov.io/gh/ipikuka/remark-flexible-toc/graph/badge.svg?token=QBNX6L8W2G
441
+ [url-codecov]: https://codecov.io/gh/ipikuka/remark-flexible-toc
442
+
443
+ [badge-type-coverage]: https://img.shields.io/badge/dynamic/json.svg?label=type-coverage&prefix=%E2%89%A5&suffix=%&query=$.typeCoverage.atLeast&uri=https%3A%2F%2Fraw.githubusercontent.com%2Fipikuka%2Fremark-flexible-toc%2Fmaster%2Fpackage.json
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,aAAa,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAuDhD,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M,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAChC,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
@@ -0,0 +1 @@
1
+ {"root":["../../src/index.ts"],"version":"5.8.3"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "remark-flexible-toc",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "Remark plugin to expose the table of contents via Vfile.data or via an option reference",
5
5
  "type": "module",
6
6
  "exports": "./dist/esm/index.js",
@@ -35,11 +35,11 @@
35
35
  "markdown",
36
36
  "MDX",
37
37
  "plugin",
38
- "remark-plugin",
38
+ "remark plugin",
39
39
  "TOC",
40
40
  "table of contents",
41
- "remark-toc",
42
- "remark-flexible-toc"
41
+ "remark toc",
42
+ "remark flexible toc"
43
43
  ],
44
44
  "author": "ipikuka <talatkuyuk@gmail.com>",
45
45
  "license": "MIT",
@@ -48,35 +48,39 @@
48
48
  "url": "https://github.com/ipikuka/remark-flexible-toc/issues"
49
49
  },
50
50
  "devDependencies": {
51
- "@types/dedent": "^0.7.2",
52
- "@types/node": "^20.11.30",
51
+ "@eslint/js": "^9.28.0",
52
+ "@types/node": "^22.15.29",
53
53
  "@types/remark-heading-id": "^1.0.0",
54
- "@typescript-eslint/eslint-plugin": "^7.3.1",
55
- "@typescript-eslint/parser": "^7.3.1",
56
- "@vitest/coverage-v8": "^1.4.0",
57
- "dedent": "^1.5.1",
58
- "eslint": "^8.57.0",
59
- "eslint-config-prettier": "^9.1.0",
60
- "eslint-plugin-prettier": "^5.1.3",
61
- "prettier": "^3.2.5",
62
- "rehype-format": "^5.0.0",
63
- "rehype-stringify": "^10.0.0",
64
- "remark-gfm": "^4.0.0",
54
+ "@vitest/coverage-v8": "^3.2.1",
55
+ "@vitest/eslint-plugin": "^1.2.1",
56
+ "dedent": "^1.6.0",
57
+ "eslint": "^9.28.0",
58
+ "eslint-config-prettier": "^10.1.5",
59
+ "eslint-plugin-prettier": "^5.4.1",
60
+ "globals": "^16.2.0",
61
+ "prettier": "^3.5.3",
62
+ "rehype-format": "^5.0.1",
63
+ "rehype-stringify": "^10.0.1",
64
+ "remark-gfm": "^4.0.1",
65
65
  "remark-heading-id": "^1.0.1",
66
66
  "remark-parse": "^11.0.0",
67
- "remark-rehype": "^11.1.0",
68
- "rimraf": "^5.0.5",
69
- "type-coverage": "^2.27.1",
70
- "typescript": "^5.4.3",
71
- "unified": "^11.0.4",
72
- "vitest": "^1.4.0"
67
+ "remark-rehype": "^11.1.2",
68
+ "rimraf": "^5.0.10",
69
+ "type-coverage": "^2.29.7",
70
+ "typescript": "^5.8.3",
71
+ "typescript-eslint": "^8.33.1",
72
+ "unified": "^11.0.5",
73
+ "vitest": "^3.2.1"
73
74
  },
74
75
  "dependencies": {
75
- "@types/mdast": "^4.0.3",
76
+ "@types/mdast": "^4.0.4",
76
77
  "github-slugger": "^2.0.0",
77
78
  "mdast-util-to-string": "^4.0.0",
78
79
  "unist-util-visit": "^5.0.0"
79
80
  },
81
+ "peerDependencies": {
82
+ "unified": "^11"
83
+ },
80
84
  "sideEffects": false,
81
85
  "typeCoverage": {
82
86
  "atLeast": 100,
package/src/index.ts CHANGED
@@ -4,10 +4,8 @@ import { visit, CONTINUE } from "unist-util-visit";
4
4
  import GithubSlugger from "github-slugger";
5
5
  import { toString } from "mdast-util-to-string";
6
6
 
7
- // eslint-disable-next-line @typescript-eslint/ban-types
8
7
  export type Prettify<T> = { [K in keyof T]: T[K] } & {};
9
8
 
10
- // eslint-disable-next-line @typescript-eslint/ban-types
11
9
  export type PartiallyRequired<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;
12
10
 
13
11
  export type HeadingParent =