/**
 * This module contains utilities to debug mathlive internal data structures.
 *
 * It is also used by the automated test suite.
 */ import { ParseMode } from '../public/core' ; import { parseLatex } from '../core/parser' ; import { LEGACY_COMMANDS , MATH_SYMBOLS , TEXT_SYMBOLS , ENVIRONMENTS , } from '../core-definitions/definitions' ; import { DEFAULT_KEYBINDINGS } from '../editor/keybindings-definitions' ; import { getKeybindingMarkup } from '../editor/keybindings' ; import { atomToAsciiMath } from '../editor/atom-to-ascii-math' ; import { parseMathString } from '../editor/parse-math-string' ; import { Atom } from '../core/atom' ; export function latexToAsciiMath ( latex , mode = 'math' ) { const root = new Atom ( 'root' , { mode : 'math' } ) ; root . body = parseLatex ( latex , { parseMode : mode } ) ; return atomToAsciiMath ( root ) ; } export function asciiMathToLatex ( ascii ) { return parseMathString ( ascii , { format : 'ascii-math' } ) [ 1 ] ; } const MathliveDebug = { latexToAsciiMath , asciiMathToLatex , FUNCTIONS : LEGACY_COMMANDS , MATH_SYMBOLS , TEXT_SYMBOLS , ENVIRONMENTS , DEFAULT_KEYBINDINGS , getKeybindingMarkup , } ; export default MathliveDebug ;