hyper_render_math

Mathematical formula rendering plugin for HyperRender. Renders <math> and <latex> tags using flutter_math_fork for high-performance LaTeX typesetting.


Installation

dependencies:
  hyper_render_math: ^1.3.1

Usage

Register MathNodePlugin — it handles both <math> and <latex> tags:

import 'package:hyper_render/hyper_render.dart';
import 'package:hyper_render_math/hyper_render_math.dart';

final registry = HyperPluginRegistry()
  ..register(const MathNodePlugin());

HyperViewer(
  html: 'The quadratic formula: '
        '<math>x = \\frac{-b \\pm \\sqrt{b^2-4ac}}{2a}</math>',
  pluginRegistry: registry,
)

Display vs inline mode

By default <math> renders in display mode (centered, larger). To render inline:

<p>Energy: <math display="inline">E = mc^2</math> in action.</p>

Or use the <latex> tag with the mode="inline" attribute:

<p>Euler's identity: <latex mode="inline">e^{i\pi} + 1 = 0</latex></p>

Inline-tier plugin

To flow equations inside text lines (without the block break), subclass and flip isInline:

class InlineMathPlugin extends MathNodePlugin {
  @override bool get isInline => true;
}

Error fallback

If a LaTeX expression cannot be parsed, the raw source is displayed in red monospace so you can identify and fix the malformed formula.


HyperRender Ecosystem

Package Description
hyper_render Main package — HyperViewer widget, HTML + Markdown rendering
hyper_render_core Core engine: UDT model, RenderHyperBox, plugin API
hyper_render_html HTML + CSS → UDT parser
hyper_render_markdown Markdown (GFM) → UDT parser
hyper_render_highlight Syntax highlighting for <code> / <pre> blocks
hyper_render_clipboard Image copy / save / share (opt-in)
hyper_render_math LaTeX / MathML rendering ← you are here
hyper_render_devtools Flutter DevTools inspector

Source · Issues · Changelog · Plugin Development Guide


License

MIT — see LICENSE.

Libraries

hyper_render_math
HyperRender math plugin — renders <math> and <latex> tags.