@progressive-development/pd-editor

Editing and showing text with structure: a Markdown input, a Markdown view and a code snippet.
Features
- Lit 3 & TypeScript – web components with type definitions
- Accessible – Built toward WCAG 2.2 AA, with keyboard navigation and ARIA support; the status of each component is in Storybook. A library can vouch for its building blocks, not for the finished page.
- Themeable – CSS custom properties (
--pd-*)
- Localized – Built-in texts in English, with translations into German, Dutch, Spanish, French and Portuguese
- Editors load when used –
pd-markdown-input loads TipTap when it first renders, pd-code-snippet loads CodeMirror only when it is switched to editing
- Form integration –
pd-markdown-input takes part in pd-form-container like every input of pd-ui-core
Installation
npm install @progressive-development/pd-shared-styles @progressive-development/pd-editor
Load the design tokens once in your app:
import '@progressive-development/pd-shared-styles/shared-root-styles.css';
The third-party libraries (TipTap, CodeMirror, Prism, marked, DOMPurify) are dependencies of the package; your bundler resolves them.
Entries
The root of the package registers no element and renders none: it exports types. Each element comes from its own entry, and importing the entry registers the element.
| Entry |
Contents |
@progressive-development/pd-editor/pd-markdown-input |
Markdown input |
@progressive-development/pd-editor/pd-markdown-view |
Markdown view |
@progressive-development/pd-editor/pd-code-snippet |
Code snippet |
@progressive-development/pd-editor/all |
Registers every element of the package |
@progressive-development/pd-editor/locales/<locale> |
The translation templates of one locale |
Examples
Markdown input
<pd-markdown-input label="Description" valueName="description"></pd-markdown-input>
<script type="module">
import '@progressive-development/pd-editor/pd-markdown-input';
</script>
The value is a Markdown string. The element sends pd-form-element-change with { value, parsedValue, name, state }; parsedValue is the HTML of the content.
Markdown view
<pd-markdown-view markdown="## Notes Shown as **sanitized** HTML."></pd-markdown-view>
<script type="module">
import '@progressive-development/pd-editor/pd-markdown-view';
</script>
Code snippet
<pd-code-snippet title="Installation" language="bash">
npm install @progressive-development/pd-editor
</pd-code-snippet>
<script type="module">
import '@progressive-development/pd-editor/pd-code-snippet';
</script>
Components
| Component |
Description |
<pd-markdown-input> |
WYSIWYG Markdown editor with toolbar and form integration |
<pd-markdown-view> |
Sanitized Markdown display (marked and DOMPurify) |
<pd-code-snippet> |
Code display with syntax highlighting and a copy button |
Documentation
📖 Full documentation: pd-components.web.app
License
MIT © PD Progressive Development UG