import type { ExportImage } from "@blocknote/core"; import "mathjax-full/js/input/tex/ams/AmsConfiguration.js"; import "mathjax-full/js/input/tex/boldsymbol/BoldsymbolConfiguration.js"; import "mathjax-full/js/input/tex/braket/BraketConfiguration.js"; import "mathjax-full/js/input/tex/cancel/CancelConfiguration.js"; import "mathjax-full/js/input/tex/color/ColorConfiguration.js"; import "mathjax-full/js/input/tex/mathtools/MathtoolsConfiguration.js"; import "mathjax-full/js/input/tex/newcommand/NewcommandConfiguration.js"; import "mathjax-full/js/input/tex/noundefined/NoUndefinedConfiguration.js"; import "mathjax-full/js/input/tex/textmacros/TextMacrosConfiguration.js"; import "mathjax-full/js/input/tex/unicode/UnicodeConfiguration.js"; /** * An {@link ExportImage} known to hold SVG markup - what * {@link latexToMathSVG} produces and rasterizers consume, so passing a * raster image to a rasterizer is a compile-time error. */ export type SVGExportImage = ExportImage & { mimeType: "image/svg+xml"; }; /** * Converts LaTeX to a self-contained {@link SVGExportImage} (via MathJax). * Synchronous and environment-independent. Invalid LaTeX is expected (the * source is user input), so it's returned as a typed error - with a message * safe to show to readers - rather than thrown. * * The image's `width`/`height` are display dimensions, derived from * `fontSize` - the surrounding font's size in the target's units (points, * CSS pixels, ...) - and also set as the SVG's intrinsic dimensions, so * renderers display it at the right size. */ export declare function latexToMathSVG(latex: string, options: { inline: boolean; fontSize: number; }): { error?: undefined; image: SVGExportImage; } | { error: string; }; /** * Rasterizes an {@link SVGExportImage} (from {@link latexToMathSVG}) to a * raster image - rendered above its display size so it stays sharp in the * exported document, at a scale of the implementation's choosing; the * returned image keeps the display dimensions. The default implementation * ({@link rasterizeSVGInBrowser}) needs a browser; exporters running * elsewhere plug in their own (e.g. backed by `@resvg/resvg-js`'s `fitTo` * zoom or `sharp`'s density). */ export type RasterizeSVG = (svg: SVGExportImage) => Promise; /** * Rasterizes an {@link SVGExportImage} to a PNG via a canvas, at `scale` * times its display size. The screen's device pixel ratio is deliberately * not consulted for the scale, since the output goes into documents, not * onto the current screen. Browser-only. */ export declare function rasterizeSVGInBrowser(svg: SVGExportImage, scale?: number): Promise;