You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -15,7 +15,7 @@ Meshery Design Embedding enables you to export a design in a format that can be
15
15
16
16
To embed your Kanvas design, follow these steps:
17
17
18
-
1.**Access Embed Option**: Within the Kanvas Designer, select the design you wish to embed in the design drawer. Click on the export icon in the menu for the selected design. The export modal will appear, click on the "Embed" option.
18
+
1.**Access Embed Option**: Within the [Kanvas Designer](https://kanvas.new/), select the design you wish to embed. Click on the export icon in the menu for the selected design. The export modal will appear, click on the "Embed" option.
19
19
20
20

21
21
@@ -34,31 +34,39 @@ To embed your Kanvas design, follow these steps:
34
34
35
35
### Customization
36
36
37
-
You can customize the styles for the embedded design by targeting CSS classes exposed or by adding inline styles. The following class can be overridden:
37
+
You can customize the styles for the embedded design in two ways: globally via CSS classes, or for a single instance via an inline style parameter.
38
38
39
-
-`embed-design-container`: for the embedding container
40
-
-`cy-container`: for the canvas
39
+
#### Global Styling (via CSS Classes)
41
40
42
-
If you have multiple embeddings on a page, you can target them all using the classes or specific ones using the div's ID in the shortcode.
41
+
For advanced global styling, you can override the default CSS rules in your site's stylesheet. This will affect all embedded designs on your site. The main classes are:
43
42
44
-
Here is a customization example:
43
+
-`.meshery-embed-container`: The main container for the embedded design. You can target its `.full` or `.half` variants for specific sizing adjustments.
44
+
-`.cy-container`: The canvas element within the container where the design itself is rendered.
45
+
46
+
Here is an example of how you could override these classes:
45
47
46
48
```html
47
49
<style>
48
-
.embed-design-container {
49
-
width: 100%;
50
-
border-radius: 1rem;
51
-
margin: 1rem;
52
-
overflow: hidden;
53
-
margin-inline: auto;
54
-
height: 35rem;
55
-
}
56
-
.embed-canvas-container {
57
-
background-color: gray;
50
+
/* Make all embed containers have a different border and background */
For styling a single instance, the recommended method is to use the `style` parameter directly in the shortcode. This provides maximum control and will override any default styles or global CSS.
embedScriptSrc="embedded-design-embed1.js"// path to the embed script
@@ -89,60 +95,116 @@ function Design() {
89
95
Make sure the `embedScriptSrc` attribute in the component points to the location of the downloaded embedding script on your react filesystem.
90
96
Usually the script is located "static" folder
91
97
92
-
93
-
### Embedding with Hugo
98
+
## Embedding with Hugo
94
99
95
100
To prepare your Hugo site to support design embedding, perform the one-time task of adding the following shortcode definition to your site's set of supported shortcodes.
96
101
97
-
__Shortcode Definition__
102
+
### Shortcode Definition
98
103
99
-
```html
104
+
<details>
105
+
<summary>Click to expand the full Shortcode Definition</summary>
-**`src`** (Required): The path to the exported JavaScript file for your design.
150
+
-**`id`** (Required): A unique ID for the embedded design container.
151
+
-**`size`** (Optional): A preset for simple sizing.
152
+
- Accepts `"full"` (default) or `"half"`.
153
+
- This parameter is ignored if `style` is used.
154
+
-**`style`** (Optional): For advanced customization.
155
+
- Allows you to provide any custom CSS inline styles.
156
+
-**This parameter has higher priority and will override the `size` parameter.**
116
157
117
-
#### Shortcode Explaination
158
+
Now that your site has shortcode support for embedding Kanvas designs, you can use the `meshery-design-embed` shortcode in any Hugo markdown file where you want to display embedded designs to your site visitors.
118
159
119
-
`src`: Specify the path to the exported JavaScript file.
120
-
`id`: Provide a unique ID for the embedded design.
121
-
`style`: (Optional) Customize the appearance of the embedded design with CSS styles. This allows you to control the height, width, border, and other visual aspects.
160
+
### Using the Shortcode
122
161
123
-
Now that your site has shortcode support for embedding Kanvas designs, you're ready to use the shortcode in any Hugo markdown file where you want embedded the designs to be visible to your site visitors.
162
+
To embed a Meshery Design in your Hugo pages, use the `meshery-design-embed`shortcode. You will need the design's exported JavaScript file and its unique ID.
124
163
125
-
#### Shortcode Usage
164
+
###Usage Examples
126
165
127
-
Following the steps to export a design will generate a JavaScript file, containing your design. Add the Javascript file to your site and embed the design by using your new shortcode. In the following example, we use an exported design, "embedded-design-dapr.js".
166
+
Place the exported `.js` file in an appropriate folder (e.g., a nearby `images` folder) and reference it in the shortcode.
128
167
129
-
Use the shortcode in your Hugo content files as shown:
This code snippet demonstrates how to embed a design named "embedded-design-dapr.js" with a specific ID. This will render an interactive diagram of a Dapr (Distributed Application Runtime) setup within your Hugo-based website.
177
+
**Half-width display:**
139
178
140
-
#### Embedded Design Example
179
+
```html
180
+
{{</* meshery-design-embed
181
+
src="../path/to/your-design.js"
182
+
id="your-unique-design-id-half"
183
+
size="half"
184
+
*/>}}
185
+
```
141
186
142
-
Finally, render your designs in your pages. When Hugo builds your website, it will process this shortcode and generate the necessary HTML and JavaScript to embed the interactive Kanvas design. After finishing the steps, the embedded design will be rendered like in the example below.
0 commit comments