@generative-dom/plugin-markdown-link
v0.1.0
Published
Generative DOM plugin — links and images
Downloads
82
Maintainers
Readme
@generative-dom/plugin-markdown-link
Inline links, images, and autolinks for Generative DOM.
Installation
pnpm add @generative-dom/plugin-markdown-linkUsage
import { GenerativeDom } from '@generative-dom/core';
import { markdownBase } from '@generative-dom/plugin-markdown-base';
import { markdownLink } from '@generative-dom/plugin-markdown-link';
const md = new GenerativeDom(container, { plugins: [markdownBase(), markdownLink()] });
md.push('[GenerativeDom](https://example.com)\n');Matching
This is an inline-only plugin matched in priority order:
Autolink — URL or mailto address wrapped in angle brackets:
<https://example.com>
<mailto:[email protected]>Image — alt text in ![], URL in (), optional quoted title:

Link — link text in [], URL in (), optional quoted title. Nested parentheses in
the URL are handled correctly:
[text](https://example.com)
[text](https://example.com "title")Configuration
- priority: 200
- level:
inline - matchDescriptor: none
Rendered Output
URLs are validated against a protocol allowlist before being set as attributes.
| Token | Element | Security |
|-------|---------|----------|
| Link / autolink | <a href="..."> | https:, http:, mailto: only |
| Image | <img src="..." alt="..." loading="lazy"> | https:, http: only |
