updates to markdown processing to allow custom elements

This commit is contained in:
2023-05-11 18:02:40 -07:00
parent 44315b324a
commit 3ddde81e1c
5 changed files with 43 additions and 32 deletions

View File

@@ -4,7 +4,7 @@ import { create_renderer } from './renderer';
import { mark_ext } from './mark';
import { section_ext } from './section';
import { icon_ext } from './icon';
import { sanitize_html } from './html-sanitize';
import { CustomElementHandling, sanitize_html } from './html-sanitize';
import { katex_block_ext, katex_inline_ext } from './katex';
import { footnote_list_ext, footnote_ref_ext } from './footnotes';
import { description_list_ext } from './description-list';
@@ -16,6 +16,7 @@ export interface MarkdownOptions {
inline?: boolean;
katex_macros?: Record<string, string>;
extensions?: MarkdownExtension[];
custom_elements?: CustomElementHandling;
}
export interface MarkdownExtension {
@@ -64,5 +65,5 @@ export async function render_markdown_to_html(markdown: string, options: Markdow
});
});
return sanitize_html(unsafe_html);
return sanitize_html(unsafe_html, options.custom_elements);
}