ChatMathRenderer

Renders LaTeX with the application's KaTeX. render returns the KaTeX HTML string, or null when math is not provided, KaTeX has not loaded yet or failed to, or the LaTeX is invalid: the view then renders the raw $…$ source.

import { ChatMathRenderer } from '@threadplane/angular/chat/math';

Declaration

export declare class ChatMathRenderer  {
  loaded(): Promise<void>;
  readonly ready: import("@angular/core").WritableSignal<boolean>;
  render(latex: string, displayMode: boolean): string | null;
}

Members

loaded · overload 1

Starts the load once and resolves when it has settled. Tests await it.

loaded(): Promise<void>;

Returns

Promise<void>

ready

Flips to true once KaTeX has loaded. The math view reads it as a signal dependency, so math that fell back to raw source while KaTeX was loading re-renders once it is available.

readonly ready: import("@angular/core").WritableSignal<boolean>;

render · overload 1

render(latex: string, displayMode: boolean): string | null;

Parameters

latex · required
string
displayMode · required
boolean

Returns

string | null