Skip to content

DanielusG/flutter_markdown_latex

Repository files navigation

Flutter Markdown Latex

Coverage Status Pub Version

This extension is created to enhance the functionality of the flutter_markdown package by adding support for rendering LaTeX in markdown. The rendering of LaTeX is achieved through the utilization of the flutter_math_fork package.

Rendering Samples

This is inline latex: \$f(x) = \\sum_{i=0}^{n} \\frac{a_i}{1+x}\$

This is block level latex:

\$
c = \\pm\\sqrt{a^2 + b^2}
\$

This is inline latex with displayMode: \$\$f(x) = \\sum_{i=0}^{n} \\frac{a_i}{1+x}\$\$

Example

Getting Started

Add dependency

Add flutter_markdown_latex to your pubspec.yaml dependencies.

Import it

import 'package:flutter_markdown_latex/flutter_markdown_latex.dart';

Render it

MarkdownBody(
  selectable: true,
  data: 'latex: \$c = \\pm\\sqrt{a^2 + b^2}\$',
  builders: {
    'latex': LatexElementBuilder(),
  },
  extensionSet: md.ExtensionSet(
    [LatexBlockSyntax()],
    [LatexInlineSyntax()],
  ),
),

About

A flutter markdown latex extension

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 37.8%
  • CMake 30.8%
  • Dart 23.0%
  • HTML 3.0%
  • Swift 2.8%
  • C 2.3%
  • Other 0.3%