-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(mdx-loader): Remark plugin to report unused MDX / Markdown direc…
…tives (#9394) Co-authored-by: sebastienlorber <lorber.sebastien@gmail.com>
- Loading branch information
Showing
19 changed files
with
506 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
...oader/src/remark/unusedDirectives/__tests__/__fixtures__/containerDirectives.md
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
5 changes: 5 additions & 0 deletions
5
...mdx-loader/src/remark/unusedDirectives/__tests__/__fixtures__/leafDirectives.md
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
17 changes: 17 additions & 0 deletions
17
...mdx-loader/src/remark/unusedDirectives/__tests__/__fixtures__/textDirectives.md
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
86 changes: 86 additions & 0 deletions
86
...usaurus-mdx-loader/src/remark/unusedDirectives/__tests__/__snapshots__/index.test.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`directives remark plugin - client compiler default behavior for container directives: console 1`] = ` | ||
[ | ||
[ | ||
"[WARNING] Docusaurus found 1 unused Markdown directives in file "packages/docusaurus-mdx-loader/src/remark/unusedDirectives/__tests__/__fixtures__/containerDirectives.md" | ||
- :::unusedDirective (7:1) | ||
Your content might render in an unexpected way. Visit https://github.com/facebook/docusaurus/pull/9394 to find out why and how to fix it.", | ||
], | ||
] | ||
`; | ||
|
||
exports[`directives remark plugin - client compiler default behavior for container directives: result 1`] = ` | ||
"<admonition type="danger"><p>Take care of snowstorms...</p></admonition> | ||
<div><p>unused directive content</p></div> | ||
<p>:::NotAContainerDirective with a phrase after</p> | ||
<p>:::</p> | ||
<p>Phrase before :::NotAContainerDirective</p> | ||
<p>:::</p>" | ||
`; | ||
|
||
exports[`directives remark plugin - client compiler default behavior for leaf directives: console 1`] = ` | ||
[ | ||
[ | ||
"[WARNING] Docusaurus found 1 unused Markdown directives in file "packages/docusaurus-mdx-loader/src/remark/unusedDirectives/__tests__/__fixtures__/leafDirectives.md" | ||
- ::unusedLeafDirective (1:1) | ||
Your content might render in an unexpected way. Visit https://github.com/facebook/docusaurus/pull/9394 to find out why and how to fix it.", | ||
], | ||
] | ||
`; | ||
|
||
exports[`directives remark plugin - client compiler default behavior for leaf directives: result 1`] = ` | ||
"<div></div> | ||
<p>Leaf directive in a phrase ::NotALeafDirective</p> | ||
<p>::NotALeafDirective with a phrase after</p>" | ||
`; | ||
|
||
exports[`directives remark plugin - client compiler default behavior for text directives: console 1`] = ` | ||
[ | ||
[ | ||
"[WARNING] Docusaurus found 2 unused Markdown directives in file "packages/docusaurus-mdx-loader/src/remark/unusedDirectives/__tests__/__fixtures__/textDirectives.md" | ||
- :textDirective3 (9:7) | ||
- :textDirective4 (11:7) | ||
Your content might render in an unexpected way. Visit https://github.com/facebook/docusaurus/pull/9394 to find out why and how to fix it.", | ||
], | ||
] | ||
`; | ||
|
||
exports[`directives remark plugin - client compiler default behavior for text directives: result 1`] = ` | ||
"<p>Simple: textDirective1</p> | ||
<pre><code class="language-sh">Simple: textDirectiveCode | ||
</code></pre> | ||
<p>Simple:textDirective2</p> | ||
<p>Simple<div>label</div></p> | ||
<p>Simple<div></div></p> | ||
<p>Simple:textDirective5</p> | ||
<pre><code class="language-sh">Simple:textDirectiveCode | ||
</code></pre>" | ||
`; | ||
|
||
exports[`directives remark plugin - server compiler default behavior for container directives: result 1`] = ` | ||
"<admonition type="danger"><p>Take care of snowstorms...</p></admonition> | ||
<div><p>unused directive content</p></div> | ||
<p>:::NotAContainerDirective with a phrase after</p> | ||
<p>:::</p> | ||
<p>Phrase before :::NotAContainerDirective</p> | ||
<p>:::</p>" | ||
`; | ||
|
||
exports[`directives remark plugin - server compiler default behavior for leaf directives: result 1`] = ` | ||
"<div></div> | ||
<p>Leaf directive in a phrase ::NotALeafDirective</p> | ||
<p>::NotALeafDirective with a phrase after</p>" | ||
`; | ||
|
||
exports[`directives remark plugin - server compiler default behavior for text directives: result 1`] = ` | ||
"<p>Simple: textDirective1</p> | ||
<pre><code class="language-sh">Simple: textDirectiveCode | ||
</code></pre> | ||
<p>Simple:textDirective2</p> | ||
<p>Simple<div>label</div></p> | ||
<p>Simple<div></div></p> | ||
<p>Simple:textDirective5</p> | ||
<pre><code class="language-sh">Simple:textDirectiveCode | ||
</code></pre>" | ||
`; |
Oops, something went wrong.