Skip to content

Commit b5a8eaf

Browse files
committed
Add custom admonition types for performance and test frameworks
1 parent ca9c0a2 commit b5a8eaf

File tree

2 files changed

+47
-1
lines changed

2 files changed

+47
-1
lines changed

docs/docusaurus.config.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ const config: Config = {
2121
deploymentBranch: 'gh-pages',
2222

2323
onBrokenLinks: 'throw',
24-
onBrokenMarkdownLinks: 'warn',
2524

2625
// Even if you don't use internationalization, you can use this field to set
2726
// useful metadata like html lang. For example, if your site is Chinese, you
@@ -61,6 +60,9 @@ const config: Config = {
6160

6261
markdown: {
6362
mermaid: true,
63+
hooks: {
64+
onBrokenMarkdownLinks: 'warn',
65+
},
6466
},
6567
themes: ['@docusaurus/theme-mermaid'],
6668

docs/src/theme/Admonition/Types.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import React from 'react';
2+
import DefaultAdmonitionTypes from '@theme-original/Admonition/Types';
3+
4+
function PerformanceAdmonition(props) {
5+
return (
6+
<DefaultAdmonitionTypes.tip {...props} title={props.title || 'Performance'}>
7+
{props.children}
8+
</DefaultAdmonitionTypes.tip>
9+
);
10+
}
11+
12+
function FromXunitAdmonition(props) {
13+
return (
14+
<DefaultAdmonitionTypes.info {...props} title={props.title || 'Coming from xUnit'}>
15+
{props.children}
16+
</DefaultAdmonitionTypes.info>
17+
);
18+
}
19+
20+
function FromNunitAdmonition(props) {
21+
return (
22+
<DefaultAdmonitionTypes.info {...props} title={props.title || 'Coming from NUnit'}>
23+
{props.children}
24+
</DefaultAdmonitionTypes.info>
25+
);
26+
}
27+
28+
function FromMstestAdmonition(props) {
29+
return (
30+
<DefaultAdmonitionTypes.info {...props} title={props.title || 'Coming from MSTest'}>
31+
{props.children}
32+
</DefaultAdmonitionTypes.info>
33+
);
34+
}
35+
36+
const AdmonitionTypes = {
37+
...DefaultAdmonitionTypes,
38+
'performance': PerformanceAdmonition,
39+
'from-xunit': FromXunitAdmonition,
40+
'from-nunit': FromNunitAdmonition,
41+
'from-mstest': FromMstestAdmonition,
42+
};
43+
44+
export default AdmonitionTypes;

0 commit comments

Comments
 (0)