@lowdefy/blocks-markdown 5.5.1 → 6.0.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.
@@ -0,0 +1,229 @@
1
+ # Copyright 2020-2026 Lowdefy, Inc
2
+
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ - title: Basic Markdown
16
+ blocks:
17
+ - id: basic_text
18
+ type: DangerousMarkdown
19
+ properties:
20
+ content: |
21
+ ## DangerousMarkdown
22
+
23
+ This block renders markdown **and** allows embedded HTML to be rendered inline.
24
+
25
+ Regular markdown features like **bold**, *italic*, ~~strikethrough~~, and [links](https://lowdefy.com) all work as expected.
26
+
27
+ - Unordered list item
28
+ - Another item
29
+
30
+ 1. Ordered item one
31
+ 2. Ordered item two
32
+
33
+ - title: Inline HTML Styling
34
+ blocks:
35
+ - id: html_colored_text
36
+ type: DangerousMarkdown
37
+ properties:
38
+ content: |
39
+ Text with <span style="color: #1890ff; font-weight: bold;">blue bold</span> and <span style="color: #52c41a;">green</span> and <span style="color: #ff4d4f; text-decoration: underline;">red underlined</span> inline HTML.
40
+
41
+ Use <span style="background-color: #ffffb8; padding: 0 4px;">highlighted text</span> to draw attention to specific words.
42
+
43
+ Mix markdown **bold** with <span style="font-style: italic; color: #722ed1;">HTML italic purple</span> seamlessly.
44
+ - id: html_styled_div
45
+ type: DangerousMarkdown
46
+ properties:
47
+ content: |
48
+ <div style="padding: 16px; background: linear-gradient(135deg, #e6f7ff 0%, #bae7ff 100%); border-radius: 8px; border: 1px solid #91d5ff;">
49
+ <strong style="font-size: 16px;">Styled Container</strong>
50
+ <p style="margin: 8px 0 0 0; color: #0050b3;">HTML divs with gradients, borders, and custom spacing render inside DangerousMarkdown.</p>
51
+ </div>
52
+
53
+ - title: Mixed Markdown and HTML
54
+ fullWidth: true
55
+ blocks:
56
+ - id: mixed_content
57
+ type: DangerousMarkdown
58
+ properties:
59
+ content: |
60
+ ## Project Status Report
61
+
62
+ Here is a summary with **markdown headings** and HTML elements combined:
63
+
64
+ <div style="display: flex; gap: 12px; flex-wrap: wrap; margin: 12px 0;">
65
+ <div style="flex: 1; min-width: 150px; padding: 12px; background: #f6ffed; border: 1px solid #b7eb8f; border-radius: 6px; text-align: center;">
66
+ <div style="font-size: 24px; font-weight: bold; color: #52c41a;">12</div>
67
+ <div style="color: #389e0d;">Completed</div>
68
+ </div>
69
+ <div style="flex: 1; min-width: 150px; padding: 12px; background: #e6f7ff; border: 1px solid #91d5ff; border-radius: 6px; text-align: center;">
70
+ <div style="font-size: 24px; font-weight: bold; color: #1890ff;">5</div>
71
+ <div style="color: #096dd9;">In Progress</div>
72
+ </div>
73
+ <div style="flex: 1; min-width: 150px; padding: 12px; background: #fff7e6; border: 1px solid #ffd591; border-radius: 6px; text-align: center;">
74
+ <div style="font-size: 24px; font-weight: bold; color: #fa8c16;">3</div>
75
+ <div style="color: #d48806;">Pending</div>
76
+ </div>
77
+ </div>
78
+
79
+ > **Note:** The cards above use HTML `div` elements with inline styles for layout.
80
+
81
+ Regular markdown continues below the HTML blocks without issue.
82
+
83
+ - title: HTML Tables with Styling
84
+ fullWidth: true
85
+ blocks:
86
+ - id: html_table_styled
87
+ type: DangerousMarkdown
88
+ properties:
89
+ content: |
90
+ <table style="width: 100%; border-collapse: collapse; font-size: 14px;">
91
+ <thead>
92
+ <tr style="background: #fafafa;">
93
+ <th style="border: 1px solid #d9d9d9; padding: 10px 16px; text-align: left;">Feature</th>
94
+ <th style="border: 1px solid #d9d9d9; padding: 10px 16px; text-align: left;">Markdown</th>
95
+ <th style="border: 1px solid #d9d9d9; padding: 10px 16px; text-align: left;">DangerousMarkdown</th>
96
+ <th style="border: 1px solid #d9d9d9; padding: 10px 16px; text-align: left;">MarkdownWithCode</th>
97
+ </tr>
98
+ </thead>
99
+ <tbody>
100
+ <tr>
101
+ <td style="border: 1px solid #d9d9d9; padding: 10px 16px;">Basic markdown</td>
102
+ <td style="border: 1px solid #d9d9d9; padding: 10px 16px; color: #52c41a;">Yes</td>
103
+ <td style="border: 1px solid #d9d9d9; padding: 10px 16px; color: #52c41a;">Yes</td>
104
+ <td style="border: 1px solid #d9d9d9; padding: 10px 16px; color: #52c41a;">Yes</td>
105
+ </tr>
106
+ <tr style="background: #fafafa;">
107
+ <td style="border: 1px solid #d9d9d9; padding: 10px 16px;">Inline HTML</td>
108
+ <td style="border: 1px solid #d9d9d9; padding: 10px 16px; color: #ff4d4f;">No</td>
109
+ <td style="border: 1px solid #d9d9d9; padding: 10px 16px; color: #52c41a;">Yes</td>
110
+ <td style="border: 1px solid #d9d9d9; padding: 10px 16px; color: #ff4d4f;">No</td>
111
+ </tr>
112
+ <tr>
113
+ <td style="border: 1px solid #d9d9d9; padding: 10px 16px;">Code highlighting</td>
114
+ <td style="border: 1px solid #d9d9d9; padding: 10px 16px; color: #ff4d4f;">No</td>
115
+ <td style="border: 1px solid #d9d9d9; padding: 10px 16px; color: #ff4d4f;">No</td>
116
+ <td style="border: 1px solid #d9d9d9; padding: 10px 16px; color: #52c41a;">Yes</td>
117
+ </tr>
118
+ <tr style="background: #fafafa;">
119
+ <td style="border: 1px solid #d9d9d9; padding: 10px 16px;">DOMPurify sanitization</td>
120
+ <td style="border: 1px solid #d9d9d9; padding: 10px 16px;">N/A</td>
121
+ <td style="border: 1px solid #d9d9d9; padding: 10px 16px; color: #52c41a;">Yes</td>
122
+ <td style="border: 1px solid #d9d9d9; padding: 10px 16px;">N/A</td>
123
+ </tr>
124
+ </tbody>
125
+ </table>
126
+
127
+ - title: Callout Boxes
128
+ blocks:
129
+ - id: callout_info
130
+ type: DangerousMarkdown
131
+ properties:
132
+ content: |
133
+ <div style="padding: 12px 16px; background-color: #e6f7ff; border-left: 4px solid #1890ff; border-radius: 0 6px 6px 0; margin-bottom: 8px;">
134
+ <strong>Info:</strong> This is an informational callout created with HTML inside DangerousMarkdown.
135
+ </div>
136
+ - id: callout_success
137
+ type: DangerousMarkdown
138
+ properties:
139
+ content: |
140
+ <div style="padding: 12px 16px; background-color: #f6ffed; border-left: 4px solid #52c41a; border-radius: 0 6px 6px 0; margin-bottom: 8px;">
141
+ <strong>Success:</strong> Your deployment completed without errors.
142
+ </div>
143
+ - id: callout_warning
144
+ type: DangerousMarkdown
145
+ properties:
146
+ content: |
147
+ <div style="padding: 12px 16px; background-color: #fffbe6; border-left: 4px solid #faad14; border-radius: 0 6px 6px 0; margin-bottom: 8px;">
148
+ <strong>Warning:</strong> Only render trusted content with DangerousMarkdown. Never pass user input directly.
149
+ </div>
150
+ - id: callout_error
151
+ type: DangerousMarkdown
152
+ properties:
153
+ content: |
154
+ <div style="padding: 12px 16px; background-color: #fff1f0; border-left: 4px solid #ff4d4f; border-radius: 0 6px 6px 0;">
155
+ <strong>Error:</strong> Connection to the database failed. Check your credentials and try again.
156
+ </div>
157
+
158
+ - title: Badge-like Elements
159
+ blocks:
160
+ - id: badges_status
161
+ type: DangerousMarkdown
162
+ properties:
163
+ content: |
164
+ **Deployment Status:**
165
+
166
+ <span style="display: inline-block; padding: 2px 10px; background: #f6ffed; color: #52c41a; border: 1px solid #b7eb8f; border-radius: 10px; font-size: 12px; margin-right: 6px;">Active</span>
167
+ <span style="display: inline-block; padding: 2px 10px; background: #fff7e6; color: #fa8c16; border: 1px solid #ffd591; border-radius: 10px; font-size: 12px; margin-right: 6px;">Pending</span>
168
+ <span style="display: inline-block; padding: 2px 10px; background: #fff1f0; color: #ff4d4f; border: 1px solid #ffa39e; border-radius: 10px; font-size: 12px; margin-right: 6px;">Failed</span>
169
+ <span style="display: inline-block; padding: 2px 10px; background: #f0f0f0; color: #8c8c8c; border: 1px solid #d9d9d9; border-radius: 10px; font-size: 12px;">Archived</span>
170
+ - id: badges_tags
171
+ type: DangerousMarkdown
172
+ properties:
173
+ content: |
174
+ **Technology Stack:**
175
+
176
+ <span style="display: inline-block; padding: 3px 10px; background: #e6f7ff; color: #096dd9; border-radius: 4px; font-size: 12px; font-weight: 500; margin: 2px 4px 2px 0;">React</span>
177
+ <span style="display: inline-block; padding: 3px 10px; background: #f9f0ff; color: #531dab; border-radius: 4px; font-size: 12px; font-weight: 500; margin: 2px 4px 2px 0;">Next.js</span>
178
+ <span style="display: inline-block; padding: 3px 10px; background: #fff0f6; color: #c41d7f; border-radius: 4px; font-size: 12px; font-weight: 500; margin: 2px 4px 2px 0;">MongoDB</span>
179
+ <span style="display: inline-block; padding: 3px 10px; background: #fcffe6; color: #5b8c00; border-radius: 4px; font-size: 12px; font-weight: 500; margin: 2px 4px 2px 0;">YAML</span>
180
+
181
+ - title: DOMPurifyOptions
182
+ blocks:
183
+ - id: dompurify_default
184
+ type: DangerousMarkdown
185
+ properties:
186
+ content: |
187
+ By default, DOMPurify removes dangerous elements like `<script>` and `<iframe>`.
188
+
189
+ This `<iframe>` tag will **not** render: <iframe src="https://example.com"></iframe>
190
+
191
+ Standard HTML like <b>bold</b> and <em>emphasis</em> still works.
192
+ - id: dompurify_custom
193
+ type: DangerousMarkdown
194
+ properties:
195
+ DOMPurifyOptions:
196
+ ALLOWED_TAGS:
197
+ - b
198
+ - i
199
+ - em
200
+ - strong
201
+ - p
202
+ - br
203
+ ALLOWED_ATTR: []
204
+ content: |
205
+ With restricted DOMPurifyOptions, only specific tags are allowed.
206
+
207
+ <b>Bold works</b> and <i>italic works</i>.
208
+
209
+ But <span style="color: red;">styled spans</span> are stripped because `span` is not in ALLOWED_TAGS and `style` is not in ALLOWED_ATTR.
210
+
211
+ - title: Style Override
212
+ blocks:
213
+ - id: style_element
214
+ type: DangerousMarkdown
215
+ style:
216
+ .element:
217
+ backgroundColor: '#fff7e6'
218
+ padding: 16
219
+ borderRadius: 8
220
+ border: '1px solid #ffd591'
221
+ properties:
222
+ content: |
223
+ ### Styled Container
224
+
225
+ The `element` style key applies CSS to the outer wrapper `div`.
226
+
227
+ <div style="padding: 8px 12px; background: white; border-radius: 4px; border: 1px solid #ffe58f;">
228
+ Combine <b>container styles</b> with <b>inline HTML styles</b> for rich layouts.
229
+ </div>
@@ -0,0 +1,34 @@
1
+ # Copyright 2020-2026 Lowdefy, Inc
2
+
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ id: dangerousmarkdown
16
+ type: Box
17
+
18
+ blocks:
19
+ - id: dangerousmarkdown_basic
20
+ type: DangerousMarkdown
21
+ properties:
22
+ content: Hello **dangerous** world
23
+
24
+ - id: dangerousmarkdown_html
25
+ type: DangerousMarkdown
26
+ properties:
27
+ content: '<div class="custom-div">HTML content</div>'
28
+
29
+ - id: dangerousmarkdown_mixed
30
+ type: DangerousMarkdown
31
+ properties:
32
+ content: |
33
+ # Heading
34
+ <span style="color: red;">Red text</span>
@@ -0,0 +1,149 @@
1
+ # Copyright 2020-2026 Lowdefy, Inc
2
+
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ - id: default
16
+ type: DangerousMarkdown
17
+ - id: properties.content
18
+ type: Box
19
+ properties:
20
+ content: |
21
+ # One Heading
22
+
23
+ A paragraph with *emphasis* and **strong importance**.
24
+
25
+ > A block quote with ~strikethrough~ and a URL: https://reactjs.org.
26
+
27
+ #### Link
28
+
29
+ [A link to Lowdefy](https://lowdefy.com)
30
+
31
+ # Two
32
+
33
+ * Lists
34
+ * [ ] todo
35
+ * [x] done
36
+
37
+ A table:
38
+
39
+ | a | b |
40
+ | - | - |
41
+
42
+ - id: properties.style and headings
43
+ type: DangerousMarkdown
44
+ properties:
45
+ content: |
46
+ # One
47
+ ## Two
48
+ ### Three
49
+ #### Four
50
+ ##### Five
51
+ ###### Six
52
+ style:
53
+ border: '1px solid blue'
54
+ - id: properties.content = table
55
+ type: DangerousMarkdown
56
+ properties:
57
+ content: |
58
+ ### Table
59
+
60
+ | A | B | C |
61
+ |---:|:---:|:---|
62
+ | one | two | three |
63
+ | 123 | 345 | 34892 |
64
+ | true | false | none |
65
+
66
+ - id: properties.content DangerousHtml
67
+ type: DangerousMarkdown
68
+ properties:
69
+ content: |
70
+ ### Link
71
+
72
+ <a href="https://lowdefy.com">Lowdefy link</a>
73
+
74
+ <font size="+10">Description</font>
75
+
76
+ ### Bad HTML
77
+
78
+ <div onmouseover="alert('alpha')">
79
+ <a href="javascript:alert('bravo')">delta</a>
80
+ <img src="x" onerror="alert('charlie')">
81
+ <iframe src="javascript:alert('delta')"></iframe>
82
+ <math>
83
+ <mi xlink:href="data:x,<script>alert('echo')</script>"></mi>
84
+ </math>
85
+ </div>
86
+ <script>
87
+ alert('script tag');
88
+ </script>
89
+
90
+ - id: properties.content with code
91
+ type: DangerousMarkdown
92
+ properties:
93
+ content: |
94
+ ### Code
95
+
96
+ Default
97
+ ```
98
+ <a href="https://lowdefy.com">Default style</a>
99
+ ```
100
+
101
+ Html
102
+ ```html
103
+ <a href="">html style</a>
104
+ <script>
105
+ alert('script tag');
106
+ </script>
107
+ ```
108
+
109
+ Json
110
+ ```json
111
+ {
112
+ "obj": "one",
113
+ "list": [
114
+ 1,
115
+ 2
116
+ ]
117
+ }
118
+ ```
119
+
120
+ Bad HTML
121
+ ```html
122
+ <div onmouseover="alert('alpha')">
123
+ <a href="javascript:alert('bravo')">delta</a>
124
+ <img src="x" onerror="alert('charlie')">
125
+ <iframe src="javascript:alert('delta')"></iframe>
126
+ <math>
127
+ <mi xlink:href="data:x,<script>alert('echo')</script>"></mi>
128
+ </math>
129
+ </div>
130
+ <script>
131
+ alert('script tag');
132
+ </script>
133
+ ```
134
+ - id: properties.html-iframe
135
+ type: DangerousMarkdown
136
+ properties:
137
+ content: |
138
+ No additional ADD_TAGS:
139
+ <iframe width="560" height="315" src="https://www.youtube.com/embed/7N7GWdlQJlU" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
140
+ - id: properties.html-DOMPurifyOptions.ADD_TAGS-iframe
141
+ type: DangerousMarkdown
142
+ properties:
143
+ DOMPurifyOptions:
144
+ ADD_TAGS:
145
+ - iframe
146
+ content: |
147
+ ## With iframe ADD_TAGS:
148
+
149
+ <iframe width="560" height="315" src="https://www.youtube.com/embed/7N7GWdlQJlU" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>