UNPKG

react-scitext

Version:

React component for rendering scientific text with Markdown, LaTeX, and SMILES support

23 lines (22 loc) 1.28 kB
import { RichTextProps } from '../../types'; /** * RichText handles *any* string coming from the backend and figures out the best way to render it. * * CONTENT PROCESSING PIPELINE: * 1. SMILES Detection: Finds <smiles>...</smiles> tags for chemical structure rendering * 2. Small Variable LaTeX: Detects simple \(m\), \(k\), etc. and renders as bold+italic HTML * 3. LaTeX Math Detection: * - Block math: \[...\] and $$...$$ (creates new lines) * - Inline math: \(...\) (stays inline, excluding small variables) * - Selective $...$ math: Only complex expressions to avoid false positives like "F_m" * 4. LaTeX Environments: \begin{env}...\end{env} for lists, equations, etc. * 5. Markdown Headings: ###, ##, # converted to HTML heading elements * 6. Remaining Content: Processed as markdown or plain text based on renderAsMarkdown flag * * @param content - The content string to render * @param renderAsMarkdown - Whether to treat non-special content as markdown (default: true) * @param inline - Whether to render content inline without prose wrapper (default: false) * @returns Rendered JSX elements */ export declare const RichText: ({ content, renderAsMarkdown, inline, }: RichTextProps) => JSX.Element | null; //# sourceMappingURL=RichText.d.ts.map