facebook / docusaurus

Easy to maintain open source documentation websites.
https://docusaurus.io
MIT License
56.84k stars 8.55k forks source link

Add a `siteConfig.markdown.onUnusedDirective: 'throw'` option #10674

Open JLHwung opened 1 week ago

JLHwung commented 1 week ago

Have you read the Contributing Guidelines on issues?

Description

The siteConfig.markdown.onUnusedDirective: 'throw' option will throw unused markdown directives.

Has this been requested on Canny?

No response

Motivation

In https://github.com/facebook/docusaurus/pull/9394 we have introduced the ability to warn unused markdown directives. This feature is very useful and helps Babel website nailed quite a few markdown directive bugs: https://github.com/babel/website/pull/3013.

Since the warning messages do not fail the build, it would be great to introduce a siteConfig.markdown.onUnusedDirective: 'throw' option so that it can be checked by the website CI.

API design

// docusaurus.config.js
{
  siteConfig: {
    markdown: {
      onUnusedDirective: 'throw'
    }
}

Have you tried building it?

No response

Self-service

AryanK1511 commented 3 days ago

Hello @slorber ! This issue sounds very interesting to me. Can you assign it to me so that I can start working on it?

slorber commented 3 days ago

We don't assign issues here because most people claiming issues later ghost us.

If you feel you can handle it on your own, just submit a draft PR directly and we'll give you merge priority and help you bring it to the finish line if your code is not too bad.