jxxcarlson / meenylatex / MiniLatex

This library exposes functions for rendering MiniLaTeX text into HTML. Most users will need only (1) the functions exposed in the MiniLatex module and (2) EditRecord, which is exposed in the Differ module.

See MiniLatex Live for a no-login demo of the MiniLatex technology. Source code

See this Hackernoon article for an explanation of the theory behind the MiniLatex package.

API

parse : String -> List LatexExpression

parse a string of LaTeX text and return its syntax tree

render : String -> String -> Html Edit.LaTeXMsg

The function call

render "" NoDelay sourceTest

produces an HTML value corresponding to the given MiniLaTeX source text. In this example, the first parameter is an id of an element to be highlighted. It can be left empty. The second parameter, here noDelay, defines the way that MathJax will go about typesetting the content passed to it. Use NoDelay for documents with not too many math elements and for editing all documents, since only changed text is re-rendered. Use Delay for loading document containing many math elements.

renderWithSeed : String -> Basics.Int -> String -> String -> Html Edit.LaTeXMsg

Like render, but used the seed to define the ids for each paragraph:

render NoDelay seed macros sourceTest


type alias LatexExpression =
Internal.Parser.LatexExpression

Type of the syntax tree


type alias LatexState =
Internal.LatexState.LatexState

Auxiliary data compiled during parsing

emptyLatexState : LatexState

Used for initialization


type alias TocEntry =
Internal.LatexState.TocEntry

Describes an entry in the table of contents


type alias TableOfContents =
Internal.LatexState.TableOfContents

The table of contents