
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
@haprompt/markdown
Advanced tools
This package contains Markdown helpers and functionality for Haprompt.
@haprompt/markdownThis package contains markdown helpers for Haprompt: import, export and shortcuts.
import {
$convertFromMarkdownString,
$convertToMarkdownString,
TRANSFORMERS,
} from '@haprompt/markdown';
editor.update(() => {
const markdown = $convertToMarkdownString(TRANSFORMERS);
...
});
editor.update(() => {
$convertFromMarkdownString(markdown, TRANSFORMERS);
});
It can also be used for initializing editor's state from markdown string. Here's an example with react <RichTextPlugin>
<HapromptComposer initialConfig={{
editorState: () => $convertFromMarkdownString(markdown, TRANSFORMERS)
}}>
<RichTextPlugin />
</HapromptComposer>
Can use <MarkdownShortcutPlugin> if using React
import { TRANSFORMERS } from '@haprompt/markdown';
import {MarkdownShortcutPlugin} from '@haprompt/react/HapromptMarkdownShortcutPlugin';
<HapromptComposer>
<MarkdownShortcutPlugin transformers={TRANSFORMERS} />
</HapromptComposer>
Or registerMarkdownShortcuts to register it manually:
import {
registerMarkdownShortcuts,
TRANSFORMERS,
} from '@haprompt/markdown';
const editor = createEditor(...);
registerMarkdownShortcuts(editor, TRANSFORMERS);
Markdown functionality relies on transformers configuration. It's an array of objects that define how certain text or nodes
are processed during import, export or while typing. @haprompt/markdown package provides set of built-in transformers:
// Element transformers
UNORDERED_LIST
CODE
HEADING
ORDERED_LIST
QUOTE
// Text format transformers
BOLD_ITALIC_STAR
BOLD_ITALIC_UNDERSCORE
BOLD_STAR
BOLD_UNDERSCORE
INLINE_CODE
ITALIC_STAR
ITALIC_UNDERSCORE
STRIKETHROUGH
// Text match transformers
LINK
And bundles of commonly used transformers:
TRANSFORMERS - all built-in transformersELEMENT_TRANSFORMERS - all built-in element transformersTEXT_FORMAT_TRANSFORMERS - all built-in text format transformersTEXT_MATCH_TRANSFORMERS - all built-in text match transformersTransformers are explicitly passed to markdown API allowing application-specific subset of markdown or custom transformers.
There're three types of transformers:
TextFormatType (bold, italic, underline, strikethrough, code, subscript and superscript)See MarkdownTransformers.js for transformer implementation examples
FAQs
This package contains Markdown helpers and functionality for Haprompt.
We found that @haprompt/markdown demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.