@kawapress/plugin-image-zoom 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -126,7 +126,7 @@ KawaPress keeps extension boundaries explicit:
126
126
  - a **Runtime Plugin** extends the real Vue App and Vue Router in both SSR and the browser;
127
127
  - a **Preset** combines configuration and plugins into a ready-to-use experience such as nagi.
128
128
 
129
- A logical plugin is installed once and can provide both generator and runtime behavior. Learn more in the [Plugin System guide](https://shenqingchuan.github.io/kawapress/en/guide/plugin-system).
129
+ A logical plugin is installed once and can provide both generator and runtime behavior. Learn more in the [Plugin System guide](https://shenqingchuan.github.io/kawapress/en/plugins/plugin-system).
130
130
 
131
131
  ## Documentation
132
132
 
@@ -134,7 +134,8 @@ A logical plugin is installed once and can provide both generator and runtime be
134
134
  - [What is KawaPress?](https://shenqingchuan.github.io/kawapress/en/guide/what-is-kawapress)
135
135
  - [Markdown Extensions](https://shenqingchuan.github.io/kawapress/en/guide/markdown-extensions)
136
136
  - [Internationalization](https://shenqingchuan.github.io/kawapress/en/guide/internationalization)
137
- - [Plugin System](https://shenqingchuan.github.io/kawapress/en/guide/plugin-system)
137
+ - [Plugin System](https://shenqingchuan.github.io/kawapress/en/plugins/plugin-system)
138
+ - [Official Plugins](https://shenqingchuan.github.io/kawapress/en/plugins/overview)
138
139
  - [Theme Customization](https://shenqingchuan.github.io/kawapress/en/guide/theme-customization)
139
140
 
140
141
  ## Contributing
package/README.zh-CN.md CHANGED
@@ -126,7 +126,7 @@ KawaPress 把扩展边界分得很清楚:
126
126
  - **Runtime Plugin** 在 SSR 和浏览器中扩展真实的 Vue App 与 Vue Router;
127
127
  - **Preset** 把配置和一组插件组合成可以直接使用的产品体验,例如 nagi。
128
128
 
129
- 一个逻辑插件只需要安装一次,同时可以提供生成侧和运行侧能力。更多内容请查看[插件体系](https://shenqingchuan.github.io/kawapress/guide/plugin-system)。
129
+ 一个逻辑插件只需要安装一次,同时可以提供生成侧和运行侧能力。更多内容请查看[插件体系](https://shenqingchuan.github.io/kawapress/plugins/plugin-system)。
130
130
 
131
131
  ## 文档
132
132
 
@@ -134,7 +134,8 @@ KawaPress 把扩展边界分得很清楚:
134
134
  - [KawaPress 是什么?](https://shenqingchuan.github.io/kawapress/guide/what-is-kawapress)
135
135
  - [Markdown 语法扩展](https://shenqingchuan.github.io/kawapress/guide/markdown-extensions)
136
136
  - [国际化](https://shenqingchuan.github.io/kawapress/guide/internationalization)
137
- - [插件体系](https://shenqingchuan.github.io/kawapress/guide/plugin-system)
137
+ - [插件体系](https://shenqingchuan.github.io/kawapress/plugins/plugin-system)
138
+ - [官方插件总览](https://shenqingchuan.github.io/kawapress/plugins/overview)
138
139
  - [主题定制](https://shenqingchuan.github.io/kawapress/guide/theme-customization)
139
140
 
140
141
  ## 参与贡献
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kawapress/plugin-image-zoom",
3
3
  "type": "module",
4
- "version": "0.1.0",
4
+ "version": "0.2.0",
5
5
  "description": "Click-to-zoom images for KawaPress Markdown content",
6
6
  "license": "MIT",
7
7
  "homepage": "https://shenqingchuan.github.io/kawapress/",
@@ -37,7 +37,7 @@
37
37
  "registry": "https://registry.npmjs.org/"
38
38
  },
39
39
  "peerDependencies": {
40
- "kawapress": "0.1.0"
40
+ "kawapress": "0.2.0"
41
41
  },
42
42
  "devDependencies": {
43
43
  "happy-dom": "^20.11.6",
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Frontmatter keys this plugin reads. Every reader of `PageFrontmatter` sees
3
+ * them while the plugin is imported.
4
+ */
5
+ declare module 'kawapress' {
6
+ interface PageFrontmatter {
7
+ /** `false` turns image zoom off for every image of this page. */
8
+ imageZoom?: boolean
9
+ }
10
+ }
11
+
12
+ export {}
package/src/index.ts CHANGED
@@ -6,6 +6,7 @@ import { createImageZoomLabelResolver, formatImageZoomLabel } from './labels'
6
6
  import { resolveLocaleLanguages } from './locale'
7
7
  import { installImageZoom } from './markdown'
8
8
  import { imageZoomOptionsPlugin } from './options-module'
9
+ import './frontmatter'
9
10
 
10
11
  export type { ImageZoomLabels, ImageZoomPluginOptions }
11
12
  export { formatImageZoomLabel, installImageZoom }
package/src/markdown.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { PageFrontmatter } from 'kawapress'
1
2
  import type { MarkdownExit, RenderRule, Token } from 'markdown-exit'
2
3
  import type { ImageZoomLabels } from './labels'
3
4
  import { ENGLISH_IMAGE_ZOOM_LABELS, formatImageZoomLabel } from './labels'
@@ -12,7 +13,7 @@ export interface ImageZoomRenderEnv {
12
13
  /** Route of the page being compiled. */
13
14
  path?: string
14
15
  /** Frontmatter of the page, read to skip pages that opt out. */
15
- frontmatter?: Record<string, unknown>
16
+ frontmatter?: PageFrontmatter
16
17
  }
17
18
 
18
19
  export interface InstallImageZoomOptions {