@rspress/plugin-preview 0.0.0-canary-20250521

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023-present Bytedance, Inc. and its affiliates.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,5 @@
1
+ # @rspress/plugin-preview
2
+
3
+ > Preview plugin for rspress
4
+
5
+ [Documentation](https://rspress.dev/plugin/official-plugins/preview)
@@ -0,0 +1,68 @@
1
+ import type { RsbuildConfig } from '@rsbuild/core';
2
+ import { RspressPlugin } from '@rspress/shared';
3
+
4
+ declare type IframeOptions = {
5
+ /**
6
+ * framework in the iframe
7
+ * @default 'react'
8
+ */
9
+ framework?: 'react' | 'solid';
10
+ /**
11
+ * position of the iframe
12
+ * @default 'follow'
13
+ */
14
+ position?: 'fixed' | 'follow' | 'fixed-with-per-comp';
15
+ /**
16
+ * dev server port for the iframe
17
+ * @default 7890
18
+ */
19
+ devPort?: number;
20
+ builderConfig?: RsbuildConfig;
21
+ };
22
+
23
+ export declare type Options = {
24
+ /**
25
+ * @deprecated Use previewMode instead.
26
+ * true = 'iframe'
27
+ * false = 'internal'
28
+ */
29
+ isMobile?: boolean;
30
+ /**
31
+ * @deprecated Use iframeOptions.position instead.
32
+ */
33
+ iframePosition?: 'fixed' | 'follow';
34
+ /**
35
+ * internal mode: component will be rendered inside the documentation, only support react.
36
+ *
37
+ * iframe mode: component will be rendered in iframe, note that aside will hide.
38
+ * @default 'internal'
39
+ */
40
+ previewMode?: 'internal' | 'iframe';
41
+ /**
42
+ * enable when preview mode is iframe.
43
+ */
44
+ iframeOptions?: IframeOptions;
45
+ /**
46
+ * determine how to handle a internal code block without meta
47
+ * @default 'preview'
48
+ */
49
+ defaultRenderMode?: 'pure' | 'preview';
50
+ /**
51
+ * Supported languages to be previewed
52
+ */
53
+ previewLanguages?: string[];
54
+ /**
55
+ * Transform previewed code in custom way
56
+ */
57
+ previewCodeTransform?: (codeInfo: {
58
+ language: string;
59
+ code: string;
60
+ }) => string;
61
+ };
62
+
63
+ /**
64
+ * The plugin is used to preview component.
65
+ */
66
+ export declare function pluginPreview(options?: Options): RspressPlugin;
67
+
68
+ export { }