UNPKG

@limetech/lime-elements

Version:
85 lines 3.64 kB
import { CustomElementDefinition } from '../../global/shared-types/custom-element.types'; /** * The Markdown component receives markdown syntax * and renders it as HTML. * * A built-in set of lime-elements components is whitelisted by default * and can be used directly in markdown content without any configuration. * Consumers can extend this list via the `whitelist` prop or `limel-config`. * * When custom elements use JSON attribute values, any URL-bearing * properties (`href`, `src`, `cite`, `longDesc`) are automatically * sanitized using the same protocol allowlists as rehype-sanitize. * URLs with dangerous schemes (e.g. `javascript:`, `data:`) are * removed (with a console warning) to prevent script injection. * * @exampleComponent limel-example-markdown-headings * @exampleComponent limel-example-markdown-emphasis * @exampleComponent limel-example-markdown-lists * @exampleComponent limel-example-markdown-links * @exampleComponent limel-example-markdown-images * @exampleComponent limel-example-markdown-code * @exampleComponent limel-example-markdown-footnotes * @exampleComponent limel-example-markdown-tables * @exampleComponent limel-example-markdown-html * @exampleComponent limel-example-markdown-keys * @exampleComponent limel-example-markdown-blockquotes * @exampleComponent limel-example-markdown-horizontal-rule * @exampleComponent limel-example-markdown-custom-component * @exampleComponent limel-example-markdown-custom-component-with-json-props * @exampleComponent limel-example-markdown-remove-empty-paragraphs * @exampleComponent limel-example-markdown-composite */ export declare class Markdown { /** * The input text. Treated as GitHub Flavored Markdown, with the addition * that any included HTML will be parsed and rendered as HTML, rather than * as text. */ value: string; /** * Additional whitelisted custom elements to render inside markdown. * * A built-in set of lime-elements components (such as `limel-chip`, * `limel-icon`, `limel-badge`, `limel-callout`, etc.) is always * allowed by default. Any entries provided here are **merged** with * those defaults — if both define the same `tagName`, their * attributes are combined. * * Can also be set via `limel-config`. Setting this property will * override the global config. * * JSON attribute values that contain URL-bearing properties * (`href`, `src`, `cite`, `longDesc`) are automatically sanitized * using the same protocol allowlists as rehype-sanitize. URLs with * dangerous schemes (e.g. `javascript:`, `data:`) are removed * (with a console warning). * * @alpha */ whitelist?: CustomElementDefinition[]; /** * Enable lazy loading for images */ lazyLoadImages: boolean; /** * Set to `false` to preserve empty paragraphs before rendering. * Empty paragraphs are paragraphs that do not contain * any meaningful content (text, images, etc.), or only contain * whitespace (`<br />` or `&nbsp;`). */ removeEmptyParagraphs: boolean; textChanged(): Promise<void>; handleWhitelistChange(): Promise<void>; handleRemoveEmptyParagraphsChange(): Promise<void>; private rootElement; private imageIntersectionObserver; private cachedConsumerWhitelist?; private cachedCombinedWhitelist?; componentDidLoad(): Promise<void>; disconnectedCallback(): void; render(): any; private setupImageIntersectionObserver; private cleanupImageIntersectionObserver; } //# sourceMappingURL=markdown.d.ts.map