ts-markdown-parser
Version:
TypeScript library that converts markdown to HTML (with code support).
34 lines • 1.45 kB
TypeScript
import { MarkdownElement } from "../models";
/**
* Escapes HTML special characters inside quotes or backticks to prevent HTML injection.
* - Converts special characters to their HTML entity equivalents.
*
* @param {string} html HTML string to be escaped.
* @returns {string} Escaped HTML string.
*/
export declare const escapeHtml: (html: string) => string;
/**
* Replaces special Unicode single quotes with a regular single quote.
*
* @param {string} text Text containing special single quotes.
* @returns {string} Text with special single quotes replaced.
*/
export declare const replaceSpecialQuotes: (text: string) => string;
/**
* Converts a Markdown string into an array of MarkdownElement objects.
* - Handles headers, code blocks, unordered lists, and paragraphs.
*
* @param {string} markdown Markdown string to be parsed.
* @returns {MarkdownElement[]} An array of MarkdownElement objects.
*/
export declare const parseMarkdown: (markdown: string) => MarkdownElement[];
/**
* Converts a MarkdownElement object to an HTML string.
* - Handles different element types including headers, code blocks, and lists.
*
* @param {MarkdownElement} element MarkdownElement object to be converted.
* @returns {string} HTML representation of the MarkdownElement.
*/
export declare const elementToHtml: (element: MarkdownElement) => string;
export declare const globalScript: () => string;
//# sourceMappingURL=markdown-parser.d.ts.map