mirror of
https://github.com/fmhy/edit.git
synced 2025-07-31 00:02:17 +10:00
fix: ignore headers properly
This commit is contained in:
parent
d6b9979464
commit
9cf2d3de79
2 changed files with 9 additions and 7 deletions
|
@ -13,9 +13,11 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import type { MarkdownRenderer } from 'vitepress'
|
||||
|
||||
const excluded = ['Credits']
|
||||
import type { MarkdownRenderer } from 'vitepress'
|
||||
import { headers } from '../transformer/constants'
|
||||
|
||||
const titles = Object.keys(headers).map((key) => headers[key].title)
|
||||
|
||||
export const headersPlugin = (md: MarkdownRenderer) => {
|
||||
// Add the Feedback component in the heading, before the link.
|
||||
|
@ -32,7 +34,7 @@ export const headersPlugin = (md: MarkdownRenderer) => {
|
|||
if (idxClose <= idx) return result
|
||||
|
||||
const level = tokens[idx].tag.slice(1)
|
||||
if (excluded.includes(env.frontmatter.title) || level !== '2') return result
|
||||
if (!titles.includes(env.frontmatter.title) || level !== '2') return result
|
||||
|
||||
// Find the token for the link.
|
||||
//
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue