Skip to content

Commit 2b8bfe0

Browse files
committed
docs(cn): translate asides
1 parent 7c16cbd commit 2b8bfe0

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/remark-plugins/remark-custom-asides/index.mjs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
*/
44

55
import { visit } from 'unist-util-visit';
6+
7+
const asideMapping = {
8+
tip: '提示',
9+
warning: '警告',
10+
todo: 'TODO'
11+
}
12+
613
export default function customAsides(
714
options = {
815
mapping: {},
@@ -49,7 +56,7 @@ export default function customAsides(
4956
children: [
5057
{
5158
type: 'text',
52-
value: `${className}`,
59+
value: `${asideMapping[className]}`,
5360
},
5461
],
5562
},

src/remark-plugins/remark-custom-asides/index.test.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ W> hello world
2121
expect(contents).toContain('<aside class="warning"');
2222
expect(contents).toContain('<h6 class="warning__prefix"');
2323
expect(contents).toContain('warning');
24-
expect(contents).toMatchSnapshot();
24+
expect(contents.replace('警告', 'warning').replace('提示', 'tip').replace('TODO', 'todo')).toMatchSnapshot();
2525
}
2626
);
2727
});

0 commit comments

Comments
 (0)