@record-evolution/widget-markdown 1.0.2 → 1.0.3
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 +88 -13
- package/dist/widget-markdown.js +4519 -5748
- package/dist/widget-markdown.js.map +1 -1
- package/package.json +10 -16
- package/src/definition-schema.d.ts +19 -1
- package/src/definition-schema.json +24 -1
- package/src/vite-env.d.ts +7 -0
- package/src/widget-markdown.ts +39 -13
- package/dist/src/widget-markdown.d.ts +0 -23
- package/dist/tsconfig.tsbuildinfo +0 -1
package/README.md
CHANGED
|
@@ -2,34 +2,109 @@
|
|
|
2
2
|
|
|
3
3
|

|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
A Lit web component for rendering markdown with syntax highlighting and variable interpolation support.
|
|
6
|
+
|
|
7
|
+
<br>
|
|
8
|
+
|
|
9
|
+
# Usage
|
|
10
|
+
|
|
11
|
+
## Installation & Import
|
|
6
12
|
|
|
7
13
|
```bash
|
|
8
|
-
npm i widget-markdown
|
|
14
|
+
npm i @record-evolution/widget-markdown
|
|
9
15
|
```
|
|
10
16
|
|
|
11
|
-
## Usage
|
|
12
|
-
|
|
13
17
|
```html
|
|
14
18
|
<script type="module">
|
|
15
|
-
import '
|
|
19
|
+
import '@record-evolution/widget-markdown'
|
|
16
20
|
</script>
|
|
17
21
|
|
|
18
|
-
<widget-markdown></widget-markdown>
|
|
22
|
+
<widget-markdown-1.0.2 inputData="default-data"></widget-markdown-1.0.2>
|
|
19
23
|
```
|
|
20
24
|
|
|
21
|
-
## Expected
|
|
25
|
+
## Expected Data Format
|
|
26
|
+
|
|
27
|
+
The widget accepts an `inputData` object with the following structure:
|
|
28
|
+
|
|
29
|
+
```json
|
|
30
|
+
{
|
|
31
|
+
"markdown": "# Hello {{userName}}\n\nWelcome to the dashboard!",
|
|
32
|
+
"data": [
|
|
33
|
+
{
|
|
34
|
+
"label": "userName",
|
|
35
|
+
"value": "John Doe"
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
```
|
|
22
40
|
|
|
23
|
-
|
|
41
|
+
### Properties
|
|
24
42
|
|
|
25
|
-
|
|
43
|
+
- **markdown** (textarea): The markdown text to render. Supports variable interpolation using `{{variableName}}` syntax.
|
|
44
|
+
- **data** (array): List of variables to replace in the markdown text.
|
|
45
|
+
- **label** (string): The variable name used in the markdown text (e.g., `userName` for `{{userName}}`).
|
|
46
|
+
- **value** (string): The value that will replace the variable placeholder.
|
|
26
47
|
|
|
27
|
-
|
|
48
|
+
### Features
|
|
28
49
|
|
|
29
|
-
|
|
50
|
+
- **Markdown Rendering**: Full CommonMark and GFM (GitHub Flavored Markdown) support via `marked`.
|
|
51
|
+
- **Syntax Highlighting**: Code blocks are automatically highlighted using `highlight.js` with support for:
|
|
52
|
+
- Shell/Bash
|
|
53
|
+
- Python
|
|
54
|
+
- JavaScript/TypeScript
|
|
55
|
+
- JSON
|
|
56
|
+
- CSS
|
|
57
|
+
- Plaintext
|
|
58
|
+
- **Variable Interpolation**: Dynamic content replacement using `{{variableName}}` placeholders.
|
|
59
|
+
- **Theme Support**: Respects platform theme colors for background and text.
|
|
60
|
+
|
|
61
|
+
<br>
|
|
62
|
+
|
|
63
|
+
## Development
|
|
64
|
+
|
|
65
|
+
> Keep the widget tag name in sync with the version in `package.json`. Update the version in `demo/index.html` accordingly (e.g., `<widget-markdown-1.0.2>`).
|
|
66
|
+
|
|
67
|
+
To develop the widget locally:
|
|
30
68
|
|
|
31
69
|
```bash
|
|
32
|
-
npm start
|
|
70
|
+
npm run start
|
|
33
71
|
```
|
|
34
72
|
|
|
35
|
-
|
|
73
|
+
This starts a development server at `localhost:8000/demo/` serving `demo/index.html`.
|
|
74
|
+
|
|
75
|
+
### Using Widget in Another Project
|
|
76
|
+
|
|
77
|
+
Install the widget in your project:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
npm i @record-evolution/widget-markdown
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Releasing a New Version
|
|
84
|
+
|
|
85
|
+
1. Commit all changes
|
|
86
|
+
2. Regenerate types from schema (if modified):
|
|
87
|
+
```bash
|
|
88
|
+
npm run types
|
|
89
|
+
```
|
|
90
|
+
3. Release:
|
|
91
|
+
```bash
|
|
92
|
+
npm run release
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
This automatically:
|
|
96
|
+
|
|
97
|
+
- Builds the widget
|
|
98
|
+
- Bumps the patch version
|
|
99
|
+
- Creates a git tag
|
|
100
|
+
- Pushes to GitHub
|
|
101
|
+
|
|
102
|
+
GitHub Actions will then publish the release to npm.
|
|
103
|
+
|
|
104
|
+
### Platform Registration
|
|
105
|
+
|
|
106
|
+
After publishing, register the new version in IronFlock:
|
|
107
|
+
|
|
108
|
+
```sql
|
|
109
|
+
select swarm.f_update_widget_master('{"package_name": "widget-markdown", "version": "1.0.2"}'::jsonb);
|
|
110
|
+
```
|