Skip to content

Commit 37a080c

Browse files
committed
refactor(plugin-markdown-preview): improve documentation and localization comments
1 parent f5e6734 commit 37a080c

File tree

6 files changed

+31
-12
lines changed

6 files changed

+31
-12
lines changed

docs/plugins/markdown/markdown-preview.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,7 @@ document.querySelector('body').innerText = 'Hello world!'
9797
}
9898
```
9999

100-
- Details:
101-
102-
Locales configuration for `<VPPreview>`.
100+
- Details: Locales configuration for `<VPPreview>`.
103101

104102
## Styles
105103

docs/zh/plugins/markdown/markdown-preview.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export default {
4949
````md
5050
<VPPreview title="可选标题">
5151
<template #content>
52-
<!-- 你的内容在这里 -->
52+
<!-- 你的内容在这里 -->
5353

5454
Hello world!
5555

@@ -67,7 +67,7 @@ document.querySelector('body').innerText = 'Hello world!'
6767

6868
<VPPreview title="可选标题">
6969
<template #content>
70-
<!-- 你的内容在这里 -->
70+
<!-- 你的内容在这里 -->
7171

7272
Hello world!
7373

@@ -91,15 +91,15 @@ document.querySelector('body').innerText = 'Hello world!'
9191
```ts
9292
export interface MarkdownPreviewLocaleData {
9393
/**
94-
* 切换代码按钮文本
94+
* Toggle code button text
95+
*
96+
* 切换代码按钮文字
9597
*/
9698
toggle: string
9799
}
98100
```
99101

100-
- 详细信息:
101-
102-
`<VPPreview>` 的多语言配置。
102+
- 详情:`<VPPreview>` 的本地化配置。
103103

104104
## 样式
105105

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
export * from './markdownPreviewPlugin.js'
2+
export type * from './options.js'
23
export * from './preview.js'

plugins/markdown/plugin-markdown-preview/src/node/markdownPreviewPlugin.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,24 @@ const PLUGIN_NAME = '@vuepress/plugin-markdown-preview'
1010

1111
const __dirname = getDirname(import.meta.url)
1212

13+
/**
14+
* Markdown preview plugin
15+
*
16+
* Markdown 预览插件
17+
*
18+
* @param options - plugin options / 插件选项
19+
*
20+
* @example
21+
* ```ts
22+
* import { markdownPreviewPlugin } from '@vuepress/plugin-markdown-preview'
23+
*
24+
* export default {
25+
* plugins: [
26+
* markdownPreviewPlugin(),
27+
* ],
28+
* }
29+
* ```
30+
*/
1331
export const markdownPreviewPlugin =
1432
(options: MarkdownPreviewPluginOptions = {}): Plugin =>
1533
(app) => ({

plugins/markdown/plugin-markdown-preview/src/node/options.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import type { MarkdownPreviewPluginLocaleData } from '../shared/index.js'
33

44
export interface MarkdownPreviewPluginOptions {
55
/**
6-
* Localization config
6+
* Localization config for preview component
77
*
8-
* 本地化配置
8+
* 预览组件的本地化配置
99
*/
1010
locales?: LocaleConfig<MarkdownPreviewPluginLocaleData>
1111
}

plugins/markdown/plugin-markdown-preview/src/shared/locales.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ import type { ExactLocaleConfig } from '@vuepress/helper'
22

33
export interface MarkdownPreviewPluginLocaleData {
44
/**
5-
* toggle code button text
5+
* Toggle code button text
6+
*
7+
* 切换代码按钮文字
68
*/
79
toggle: string
810
}

0 commit comments

Comments
 (0)