/** * The figures view's "insert into paper" pure rules: the `\label` sanitization, * the standard figure block, duplicate detection against the current * `main.tex` draft, and the insertion-point computation. The button lives on * the figures view, where the paper editor is UNMOUNTED, so no cursor-based * anchor exists — the block lands at the end of the document body, right * before `\end{document}` (a `[t]` float, so the source position barely * matters to the rendered page). DOM-free so every rule is unit-testable. * @module dsh-client-ui-mimir/client/figure-insert */ /** * Whether one figure file name is an SVG. LaTeX's `\includegraphics` cannot * embed SVG directly and the paper scaffold carries no SVG convention (no * inkscape/`svg` package), so the insert flow first asks the host to convert * the SVG into an embeddable product (see {@link svgConvertedRelPaths}) * instead of writing a block that breaks the compile. */ export declare function isSvgFigure(name: string): boolean; /** * The paper-directory-relative paths one SVG's converted product can land on, * most preferred first: the vector pipeline's `foo.pdf`, then the raster * fallback's `foo.png` (same directory, same stem). The duplicate guard * checks these alongside the SVG's own path so an already-inserted product * reads as "already inserted" instead of converting again. */ export declare function svgConvertedRelPaths(relPath: string): string[]; /** * The `\label` stem of one figure path: the basename minus its extension, with * every run of label-unsafe characters folded to a single dash and edge dashes * trimmed. An all-unsafe stem falls back to `figure` so the label is never * empty. */ export declare function figureLabelOf(relPath: string): string; /** * The standard figure block one insert writes: a top float spanning the * column, captioned with the figure's wiki-recorded caption (empty when the * file was never registered through `figure_save`) and labelled from the * sanitized file stem. */ export declare function figureBlockOf(relPath: string, caption: string): string; /** * Find the 1-based line of the first `\includegraphics` already referencing * one figure path — the insert button's duplicate guard. LaTeX allows dropping * the extension, so `{figures/foo}` counts as a reference to * `figures/foo.png`. Commented-out lines do not count. * @param content - the current `main.tex` draft. * @param relPath - figure path relative to the paper directory. * @returns the 1-based line of the existing reference, or null. */ export declare function findFigureReferenceLine(content: string, relPath: string): number | null; /** Outcome of {@link insertFigureBlock}: the next draft and where the block landed. */ export interface FigureInsertion { readonly content: string; /** 1-based line of the inserted block's `\begin{figure}` row. */ readonly line: number; } /** * Splice one figure block into the draft at the end of the document body: * right before the `\end{document}` line, with one blank line separating the * block from its neighbors. A draft without `\end{document}` (a fragment, or * a template still being written) appends the block after the last content * line instead. Everything else survives byte-for-byte. * @param content - the current `main.tex` draft. * @param block - the block text from {@link figureBlockOf}. * @returns the next draft plus the 1-based line the block starts on. */ export declare function insertFigureBlock(content: string, block: string): FigureInsertion; //# sourceMappingURL=figure-insert.d.ts.map