@humanspeak/svelte-markdown
Version:
Fast, customizable markdown renderer for Svelte with built-in caching, TypeScript support, and Svelte 5 runes
69 lines (68 loc) • 1.92 kB
JavaScript
export { default as Slugger } from 'github-slugger';
export { Lexer } from 'marked';
import {} from '../renderers/html/index.js';
import { Blockquote, Br, Code, Codespan, Del, Em, Escape, Heading, Hr, Html, Image, Link, List, ListItem, Paragraph, RawText, Strong, Table, TableBody, TableCell, TableHead, TableRow, Text } from '../renderers/index.js';
/**
* Default renderer configuration mapping markdown elements to Svelte components.
* Provides out-of-the-box rendering capabilities while allowing for customization.
*
* Implementation notes:
* - All components are lazy-loaded for better performance
* - Null values indicate optional renderers
* - Components are type-checked against the Renderers interface
*
* @const {Renderers}
*/
export const defaultRenderers = {
heading: Heading,
paragraph: Paragraph,
text: Text,
image: Image,
link: Link,
em: Em,
escape: Escape,
strong: Strong,
codespan: Codespan,
del: Del,
table: Table,
tablehead: TableHead,
tablebody: TableBody,
tablerow: TableRow,
tablecell: TableCell,
list: List,
orderedlistitem: null,
unorderedlistitem: null,
listitem: ListItem,
hr: Hr,
html: Html,
blockquote: Blockquote,
code: Code,
br: Br,
rawtext: RawText
};
/**
* Default configuration options for the markdown parser.
* Provides sensible defaults while allowing for customization.
*
* Notable defaults:
* - GitHub Flavored Markdown enabled
* - Header IDs generated automatically
* - No syntax highlighting by default
* - HTML sanitization disabled
* - Standard markdown parsing rules
*
* @const {SvelteMarkdownOptions}
*/
export const defaultOptions = {
async: false,
breaks: false,
gfm: true,
pedantic: false,
renderer: null,
silent: false,
tokenizer: null,
walkTokens: null,
// Custom options
headerIds: true,
headerPrefix: ''
};