-1

Docusaurus requires Markdown documents to have headers with some meta information, e.g.

---
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.

friederbluemle
  • 33,549
  • 14
  • 108
  • 109

1 Answers1

0

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

Yangshun Tay
  • 49,270
  • 33
  • 114
  • 141