简体   繁体   中英

Docusaurus: Add file headers to many files quickly

Docusaurus requires Markdown documents to have headers with some meta information, eg

---
id: doc1
title: My Document
sidebar_label: Document
---

I have 100 existing .md files that I want to use with Docusaurus.

Question: What's the best/fastest way to insert such a header into each file?

Bonus points if it automatically uses the file name (without extension) as the id , and any existing L1 or L2 header (without the # / ## prefix from line 1) as the title .

You can write a bash script/Node script to do this. This is not within the scope of Docusaurus.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM