Feature Configuration
Use featuresConfigs to configure features
purrmd({
featuresConfigs: {
[PurrMDFeatures.Link]: {
...
},
...
},
})Supported configurations:
interface PurrMDFeatureConfig {
[PurrMDFeatures.Blockquote]?: BlockquoteConfig;
[PurrMDFeatures.CodeBlock]?: CodeBlockConfig;
[PurrMDFeatures.Emphasis]?: EmphasisConfig;
[PurrMDFeatures.Heading]?: HeadingConfig;
[PurrMDFeatures.Highlight]?: HighlightConfig;
[PurrMDFeatures.HorizontalRule]?: HorizontalRuleConfig;
[PurrMDFeatures.Image]?: ImageConfig;
[PurrMDFeatures.InlineCode]?: InlineCodeConfig;
[PurrMDFeatures.Link]?: LinkConfig;
[PurrMDFeatures.List]?: ListConfig;
[PurrMDFeatures.Strikethrough]?: StrikethroughConfig;
[PurrMDFeatures.Strong]?: StrongConfig;
}Blockquote - Blockquote
No configuration available
interface BlockquoteConfig {}Code Block - CodeBlock
alwaysShowMarkdownMarksWhether fenced-code Markdown marks are always visible. Defaults tofalse; globalformattingDisplayMode: 'show'still shows Markdown marks for every feature.copySuccessIconIcon used by the built-in copy-success feedback. Accepts plain text or a function returning DOM/SVG. Defaults to💕.copySuccessDurationMsDuration of the copy-success feedback. Defaults to3000ms.onCodeBlockInfoClickClick event for the language button in the upper right corner of the code block
interface CodeBlockConfig {
alwaysShowMarkdownMarks?: boolean;
copySuccessIcon?: string | ((context: { language: string; code: string }) => Node | null);
copySuccessDurationMs?: number;
onCodeBlockInfoClick?: (lang: string, code: string, event: MouseEvent) => void;
}When onCodeBlockInfoClick is set, the caller takes ownership of the click behavior, copying, and success feedback.
Emphasis - Emphasis
No configuration available
interface EmphasisConfig {}Heading - Heading
No configuration available
interface HeadingConfig {}Highlight - Highlight
No configuration available
interface HighlightConfig {}Horizontal Rule - HorizontalRule
onClickClick event for horizontal rule
interface HorizontalRuleConfig {
onClick?: (event: MouseEvent, view: EditorView, node: SyntaxNodeRef) => void;
}Image - Image
proxyURLProxy URL. The URL obtained through this method will be rendered to the img element.imageAlwaysShowWhether to always display images, even when Markdown tags ([]()) are shown.NoImageAvailableLabelPrompt text when the image is unavailable. Default:"No image available".ImageLoadFailedLabelPrompt text when the image fails to load. Default:(url) => `Image failed to load: ${url}`.onImageDownImage click eventonImageTouchEndImage touch-tap event. purrmd synchronously selects the image Markdown during the originaltouchend; scrolling gestures do not trigger it.
interface ImageConfig {
proxyURL?: (url: string) => string;
imageAlwaysShow?: boolean;
NoImageAvailableLabel?: string;
ImageLoadFailedLabel?: (url: string) => string;
onImageDown?: (
e: MouseEvent,
url: string | null | undefined,
rawUrl: string | null | undefined,
) => void;
onImageTouchEnd?: (
e: TouchEvent,
url: string | null | undefined,
rawUrl: string | null | undefined,
) => void;
}Inline Code - InlineCode
No configuration available
interface InlineCodeConfig {}Link - Link
clickToOpenInSourceHow to open links in source mode:'controlOrCommand'Hold Control or Command key and click to open the link'click'Click to open the link'none'Do not open the link
clickToOpenInPreviewHow to open links in preview mode:'controlOrCommand'Hold Control or Command key and click to open the link'click'Click to open the link'none'Do not open the link
onLinkClickSourceLink click event in source modeonLinkClickPreviewLink click event in preview mode
interface LinkConfig {
clickToOpenInSource?: 'controlOrCommand' | 'click' | 'none';
clickToOpenInPreview?: 'controlOrCommand' | 'click' | 'none';
onLinkClickSource?: (url: string, event: MouseEvent) => void;
onLinkClickPreview?: (url: string, event: MouseEvent) => void;
}List - List
taskItemReadonlyWhether task lists are read-onlyonTaskItemCheckedTask list checked event
export interface ListConfig {
taskItemReadonly?: boolean;
onTaskItemChecked?: (checked: boolean, event: Event) => void;
}Strikethrough - Strikethrough
No configuration available
interface StrikethroughConfig {}Strong - Strong
No configuration available
interface StrongConfig {}