| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent d96a97a commit 1ff375b
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -24,7 +24,6 @@ | |||
| 24 | 24 | const common = require('./common.js'); | |
| 25 | 25 | const fs = require('fs'); | |
| 26 | 26 | const unified = require('unified'); | |
| 27 | - const find = require('unist-util-find'); | ||
| 28 | 27 | const visit = require('unist-util-visit'); | |
| 29 | 28 | const markdown = require('remark-parse'); | |
| 30 | 29 | const gfm = require('remark-gfm'); | |
@@ -97,7 +96,13 @@ function toHTML({ input, content, filename, nodeVersion, versions }) { | |||
| 97 | 96 | // Set the section name based on the first header. Default to 'Index'. | |
| 98 | 97 | function firstHeader() { | |
| 99 | 98 | return (tree, file) => { | |
| 100 | - const heading = find(tree, { type: 'heading' }); | ||
| 99 | + let heading; | ||
| 100 | + visit(tree, (node) => { | ||
| 101 | + if (node.type === 'heading') { | ||
| 102 | + heading = node; | ||
| 103 | + return false; | ||
| 104 | + } | ||
| 105 | + }); | ||
| 101 | 106 | ||
| 102 | 107 | if (heading && heading.children.length) { | |
| 103 | 108 | const recursiveTextContent = (node) => | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -17,7 +17,6 @@ | |||
| 17 | 17 | "remark-rehype": "8.0.0", | |
| 18 | 18 | "to-vfile": "6.1.0", | |
| 19 | 19 | "unified": "9.2.0", | |
| 20 | - "unist-util-find": "^1.0.2", | ||
| 21 | 20 | "unist-util-select": "3.0.4", | |
| 22 | 21 | "unist-util-visit": "2.0.3" | |
| 23 | 22 | }, | |
| Back | FazBrowse Home | New Git URL |
0 commit comments