From 182702aecd13fb228fad0c72750467564d4e347e Mon Sep 17 00:00:00 2001 From: Jule Marcoueille Date: Wed, 6 Jan 2021 23:57:19 +0100 Subject: [PATCH 1/8] Hast refactoring and new placeholder feature --- README.md | 1 + package-lock.json | 7704 +++++++++++++++++++++++++++++++--- package.json | 22 +- src/create-toc.ts | 21 +- src/customization-hooks.ts | 31 +- src/fiind-headings.ts | 29 - src/find-headings.ts | 31 + src/find-main-node.ts | 24 +- src/find-placeholder-node.ts | 39 + src/get-inner-text.ts | 5 +- src/index.ts | 1 + src/insert-toc.ts | 46 +- src/options.ts | 17 +- src/rehype-toc.ts | 19 +- src/type-guards.ts | 39 +- src/types.ts | 34 +- 16 files changed, 7335 insertions(+), 728 deletions(-) delete mode 100644 src/fiind-headings.ts create mode 100644 src/find-headings.ts create mode 100644 src/find-placeholder-node.ts diff --git a/README.md b/README.md index b541522..c874970 100644 --- a/README.md +++ b/README.md @@ -227,6 +227,7 @@ The Rehype TOC plugin supports the following options: |:---------------------|:-------------------|:----------------------|:----------------------------------------- |`nav` |boolean |true |Determines whether the table of contents is wrapped in a `