@record-evolution/widget-markdown
v1.0.5
Published
Webcomponent widget-markdown following open-wc recommendations
Readme
<widget-markdown>
![]()
A Lit web component for rendering markdown with syntax highlighting and variable interpolation support.
Usage
Installation & Import
npm i @record-evolution/widget-markdown<script type="module">
import '@record-evolution/widget-markdown'
</script>
<widget-markdown-1.0.2 inputData="default-data"></widget-markdown-1.0.2>Expected Data Format
The widget accepts an inputData object with the following structure:
{
"markdown": "# Hello {{userName}}\n\nWelcome to the dashboard!",
"data": [
{
"label": "userName",
"value": "John Doe"
}
]
}Properties
- markdown (textarea): The markdown text to render. Supports variable interpolation using
{{variableName}}syntax. - data (array): List of variables to replace in the markdown text.
- label (string): The variable name used in the markdown text (e.g.,
userNamefor{{userName}}). - value (string): The value that will replace the variable placeholder.
- label (string): The variable name used in the markdown text (e.g.,
Features
- Markdown Rendering: Full CommonMark and GFM (GitHub Flavored Markdown) support via
marked. - Syntax Highlighting: Code blocks are automatically highlighted using
highlight.jswith support for:- Shell/Bash
- Python
- JavaScript/TypeScript
- JSON
- CSS
- Plaintext
- Variable Interpolation: Dynamic content replacement using
{{variableName}}placeholders. - Theme Support: Respects platform theme colors for background and text.
Development
Keep the widget tag name in sync with the version in
package.json. Update the version indemo/index.htmlaccordingly (e.g.,<widget-markdown-1.0.2>).
To develop the widget locally:
npm run startThis starts a development server at localhost:8000/demo/ serving demo/index.html.
Using Widget in Another Project
Install the widget in your project:
npm i @record-evolution/widget-markdownReleasing a New Version
- Commit all changes
- Regenerate types from schema (if modified):
npm run types - Release:
npm run release
This automatically:
- Builds the widget
- Bumps the patch version
- Creates a git tag
- Pushes to GitHub
GitHub Actions will then publish the release to npm.
Platform Registration
After publishing, register the new version in IronFlock:
select swarm.f_update_widget_master('{"package_name": "widget-markdown", "version": "1.0.2"}'::jsonb);