UNPKG

mathpix-markdown-it

Version:

Mathpix-markdown-it is an open source implementation of the mathpix-markdown spec written in Typescript. It relies on the following open source libraries: MathJax v3 (to render math with SVGs), markdown-it (for standard Markdown parsing)

43 lines (42 loc) 1.56 kB
type TExtractedCodeBlock = { id: string; content: string; }; /** * Clear all previously extracted code blocks. */ export declare const ClearExtractedCodeBlocks: () => void; /** * Add a single extracted code block to the internal storage. */ export declare const addExtractedCodeBlock: (item: TExtractedCodeBlock) => void; /** * Replace placeholder markers (e.g. <<uuid>> or <uuid>) in a string * with the corresponding extracted code block content. * * Returns the updated string with placeholders resolved and post-processed * by `getContent`. */ export declare const getExtractedCodeBlockContent: (inputStr: string, i: number) => string; /** * Post-process inline code-like items in an array of results: * for items of the given `type` replace their content using * `getExtractedCodeBlockContent`. */ export declare const codeInlineContent: (res: any, type?: string) => any; /** * Replaces all inline code spans in the given string with `{id}` placeholders * and stores the original code in an external table via `mathTablePush`. * * Flow: * 1. First hides fenced/LaTeX code blocks via `getSubCodeBlock`. * 2. Then finds inline code spans (e.g. `...` or ``...``) with * `getInlineCodeListFromString`. * 3. For each span: generates an id, pushes `{ id, content }` to math table, * and replaces the span in the text with `{id}`. * * @param input - Original source string. * @returns String where inline code is replaced by `{id}` placeholders. */ export declare const getSubCode: (input: string) => string; export {};