Skip to content

Commit

Permalink
docs(cn): translate asides
Browse files Browse the repository at this point in the history
  • Loading branch information
Yucohny committed Nov 20, 2023
1 parent 7c16cbd commit 2b8bfe0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/remark-plugins/remark-custom-asides/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
*/

import { visit } from 'unist-util-visit';

const asideMapping = {
tip: '提示',
warning: '警告',
todo: 'TODO'
}

export default function customAsides(
options = {
mapping: {},
Expand Down Expand Up @@ -49,7 +56,7 @@ export default function customAsides(
children: [
{
type: 'text',
value: `${className}`,
value: `${asideMapping[className]}`,
},
],
},
Expand Down
2 changes: 1 addition & 1 deletion src/remark-plugins/remark-custom-asides/index.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ W> hello world
expect(contents).toContain('<aside class="warning"');
expect(contents).toContain('<h6 class="warning__prefix"');
expect(contents).toContain('warning');
expect(contents).toMatchSnapshot();
expect(contents.replace('警告', 'warning').replace('提示', 'tip').replace('TODO', 'todo')).toMatchSnapshot();
}
);
});
Expand Down

0 comments on commit 2b8bfe0

Please sign in to comment.