Skip to content

Commit d35a0a9

Browse files
committed
docs: updated vitepress-plugin-enhanced-readabilities-plugin
1 parent f13934b commit d35a0a9

4 files changed

Lines changed: 103 additions & 56 deletions

File tree

docs/.vitepress/theme/index.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@ import { h } from 'vue'
22
import DefaultTheme from 'vitepress/theme'
33
import type { Theme as ThemeConfig } from 'vitepress'
44

5+
import type { Options as NolebaseEnhancedReadabilitiesOptions } from '@nolebase/vitepress-plugin-enhanced-readabilities'
6+
57
import {
6-
NolebaseEnhancedReadabilitiesMenu,
7-
NolebaseEnhancedReadabilitiesScreenMenu,
8+
InjectionKey as NolebaseEnhancedReadabilitiesInjectionKey,
9+
LayoutMode as NolebaseEnhancedReadabilitiesLayoutMode,
10+
NolebaseEnhancedReadabilitiesMenu, NolebaseEnhancedReadabilitiesScreenMenu,
811
} from '@nolebase/vitepress-plugin-enhanced-readabilities'
912

1013
import {
@@ -14,7 +17,6 @@ import {
1417
import 'virtual:uno.css'
1518

1619
import '@nolebase/vitepress-plugin-enhanced-readabilities/dist/style.css'
17-
1820
import '@nolebase/vitepress-plugin-inline-link-preview/dist/style.css'
1921

2022
import './styles/vars.css'
@@ -37,6 +39,14 @@ export const Theme: ThemeConfig = {
3739
enhanceApp({ app }) {
3840
app.component('IntegrationCard', IntegrationCard)
3941
app.use(NolebaseInlineLinkPreview)
42+
app.provide(NolebaseEnhancedReadabilitiesInjectionKey, {
43+
layoutSwitch: {
44+
defaultMode: NolebaseEnhancedReadabilitiesLayoutMode.FullWidth,
45+
},
46+
spotlight: {
47+
defaultToggle: true,
48+
},
49+
} as NolebaseEnhancedReadabilitiesOptions)
4050
},
4151
}
4252

docs/pages/en/integrations/vitepress-plugin-enhanced-readabilities/index.md

Lines changed: 44 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
See the <span i-icon-park-outline:book-open text-red-400 /> button in the upper right corner on navigation bar? You can use your mouse to hover over it to see the supported features, click on the one you are interested in to see the effect!
66

77
::: warning Caution
8-
The "**Layout Switch**" and "**Inline Highlight**" features of Enhanced Readabilities plugin are temporarily unavailable on screens on mobile devices, so if you're reading on mobile but still want to see the results, check out the video demo below.
8+
The "**Layout Switch**" and "**Spotlight**" features of Enhanced Readabilities plugin are temporarily unavailable on screens on mobile devices, so if you're reading on mobile but still want to see the results, check out the video demo below.
99
:::
1010

1111
::: details Video demo
@@ -31,7 +31,7 @@ I know that this kind of functionality can be made into a browser plugin to cove
3131
### Features included
3232

3333
1. Layout switch
34-
2. Inline highlight
34+
2. Spotlight
3535

3636
## How to use
3737

@@ -288,12 +288,12 @@ import {
288288
} from '@nolebase/vitepress-plugin-enhanced-readabilities'
289289
```
290290

291-
#### Import inline highlight components on demand
291+
#### Import spotlight components on demand
292292

293293
```typescript
294294
import {
295-
InlineHighlight, // [!code focus]
296-
ScreenInlineHighlight, // [!code focus]
295+
Spotlight, // [!code focus]
296+
ScreenSpotlight, // [!code focus]
297297
} from '@nolebase/vitepress-plugin-enhanced-readabilities'
298298
```
299299

@@ -357,26 +357,54 @@ export interface Options {
357357
* 'en': {
358358
* title: {
359359
* title: 'Reading Mode',
360-
* titleAriaLabel: 'Reading Mode',
360+
* titleAriaLabel: 'Reading Mode',
361+
* },
361362
* },
362363
* 'zh-CN': {
363364
* title: {
364365
* title: '阅读模式',
365366
* titleAriaLabel: '阅读模式',
367+
* },
366368
* },
367369
* }
368370
* }
369371
* ```
370372
*/
371373
locales?: Record<string, Locale>
372-
/**
373-
* Disable layout switch help tooltip
374-
*/
375-
disableLayoutSwitchHelp?: boolean
376-
/**
377-
* Disable inline highlight help tooltip
378-
*/
379-
disableInlineHighlightHelp?: boolean
374+
layoutSwitch?: {
375+
/**
376+
* Disable layout switch help tooltip
377+
*
378+
* @default false
379+
*/
380+
disableHelp?: boolean
381+
/**
382+
* Default mode for layout switch
383+
*
384+
* @default LayoutMode.FitContentWidth (3) Fit content width
385+
*/
386+
defaultMode?: LayoutMode
387+
}
388+
spotlight?: {
389+
/**
390+
* Disable spotlight help tooltip
391+
*
392+
* @default false
393+
*/
394+
disableHelp?: boolean
395+
/**
396+
* Spotlight block color
397+
*
398+
* @default 'rgb(240 197 52 / 10%)'
399+
*/
400+
hoverBlockColor?: string
401+
/**
402+
* Default toggle for spotlight
403+
*
404+
* @default false
405+
*/
406+
defaultToggle?: boolean
407+
}
380408
}
381409
```
382410

@@ -513,9 +541,9 @@ export interface Locale {
513541
optionFitContentWidthHelpMessage?: string
514542
}
515543
/**
516-
* Inline highlight configuration
544+
* Spotlight configuration
517545
*/
518-
inlineHighlight?: {
546+
spotlight?: {
519547
/**
520548
* Title text
521549
*/

docs/pages/zh-CN/integrations/vitepress-plugin-enhanced-readabilities/index.md

Lines changed: 45 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
看到右上角的 <span i-icon-park-outline:book-open text-red-400 /> 按钮了吗?你可以使用鼠标悬浮在上面来看到支持的功能,点选一个你感兴趣的功能来看看效果吧!
66

77
::: warning 注意
8-
阅读增强的「**布局切换**」和「**行内高亮**」功能在移动端暂时不可用,如果你正在使用移动端阅读但还是想要看看效果的话,不妨看看下面的视频演示。
8+
阅读增强的「**布局切换**」和「**聚光灯**」功能在移动端暂时不可用,如果你正在使用移动端阅读但还是想要看看效果的话,不妨看看下面的视频演示。
99
:::
1010

1111
::: details 视频演示
@@ -31,7 +31,7 @@
3131
### 带来了什么功能
3232

3333
1. 布局切换
34-
2. 行内高亮
34+
2. 聚光灯
3535

3636
## 如何使用
3737

@@ -289,12 +289,12 @@ import {
289289
} from '@nolebase/vitepress-plugin-enhanced-readabilities'
290290
```
291291

292-
#### 按需导入行内高亮组件
292+
#### 按需导入聚光灯组件
293293

294294
```typescript
295295
import {
296-
InlineHighlight, // [!code focus]
297-
ScreenInlineHighlight, // [!code focus]
296+
Spotlight, // [!code focus]
297+
ScreenSpotlight, // [!code focus]
298298
} from '@nolebase/vitepress-plugin-enhanced-readabilities'
299299
```
300300

@@ -337,21 +337,12 @@ export const Theme: ThemeConfig = {
337337

338338
```typescript
339339
/**
340-
* Options
341-
*
342340
* 配置项
343341
*/
344342
export interface Options {
345343
/**
346-
* Internationalization configuration
347-
*
348344
* 国际化配置
349345
*
350-
* When configuring, please configure according to the language code configured in
351-
* VitePress internationalization configuration. In the following configuration, 'en'
352-
* and 'zh-CN' are the language codes configured in VitePress internationalization
353-
* configuration.
354-
*
355346
* 配置的时候请根据 VitePress 中国际化配置中所配置的语言代码来配置,以下面的配置为例的话,'en'
356347
* 和 'zh-CN' 是 VitePress 的国际化配置中所配置的语言代码。
357348
*
@@ -363,30 +354,54 @@ export interface Options {
363354
* 'en': {
364355
* title: {
365356
* title: 'Reading Mode',
366-
* titleAriaLabel: 'Reading Mode',
357+
* titleAriaLabel: 'Reading Mode',
358+
* },
367359
* },
368360
* 'zh-CN': {
369361
* title: {
370362
* title: '阅读模式',
371363
* titleAriaLabel: '阅读模式',
364+
* },
372365
* },
373366
* }
374367
* }
375368
* ```
376369
*/
377370
locales?: Record<string, Locale>
378-
/**
379-
* Disable layout switch help tooltip
380-
*
381-
* 显示布局切换帮助提示
382-
*/
383-
disableLayoutSwitchHelp?: boolean
384-
/**
385-
* Disable inline highlight help tooltip
386-
*
387-
* 显示行内高亮帮助提示
388-
*/
389-
disableInlineHighlightHelp?: boolean
371+
layoutSwitch?: {
372+
/**
373+
* 显示布局切换帮助提示
374+
*
375+
* @default false
376+
*/
377+
disableHelp?: boolean
378+
/**
379+
* 布局切换默认模式
380+
*
381+
* @default LayoutMode.FitContentWidth (3) 自适应内容宽度
382+
*/
383+
defaultMode?: LayoutMode
384+
}
385+
spotlight?: {
386+
/**
387+
* 显示聚光灯帮助提示
388+
*
389+
* @default false
390+
*/
391+
disableHelp?: boolean
392+
/**
393+
* 聚光灯器鼠标悬停块颜色
394+
*
395+
* @default 'rgb(240 197 52 / 10%)'
396+
*/
397+
hoverBlockColor?: string
398+
/**
399+
* 聚光灯默认模式
400+
*
401+
* @default false
402+
*/
403+
defaultToggle?: boolean
404+
}
390405
}
391406
```
392407

@@ -562,11 +577,11 @@ export interface Locale {
562577
optionFitContentWidthHelpMessage?: string
563578
}
564579
/**
565-
* Inline highlight configuration
580+
* Spotlight configuration
566581
*
567-
* 行内高亮配置
582+
* 聚光灯配置
568583
*/
569-
inlineHighlight?: {
584+
spotlight?: {
570585
/**
571586
* Title text
572587
*

tsconfig.json

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"compilerOptions": {
3-
"baseUrl": ".",
43
"module": "ESNext",
54
"target": "ESNext",
65
"lib": [
@@ -20,12 +19,7 @@
2019
"types": [
2120
"vite/client",
2221
"vue/ref-macros"
23-
],
24-
"paths": {
25-
"@nolebase/markdown-it-element-transform": ["./packages/markdown-it-element-transform/src/index.ts"],
26-
"@nolebase/vitepress-plugin-enhanced-readabilities": ["./packages/vitepress-plugin-enhanced-readabilities/dist/index.d.ts"],
27-
"@nolebase/vitepress-plugin-inline-link-preview": ["./packages/vitepress-plugin-inline-link-preview/dist/index.d.ts"]
28-
}
22+
]
2923
},
3024
"include": [
3125
"packages/**/*.ts",

0 commit comments

Comments
 (0)