Skip to content

Migrating from upstream

This package ports Temml 0.14.0. The behavior follows upstream; the names follow .NET conventions.

JavaScript C#
temml.renderToString(tex, options) TemmlRenderer.RenderToString(tex, options)
temml.render(tex, element, options) TemmlDom.Render(tex, element, options)
temml.renderMathInElement(element, options) TemmlDom.RenderMathInElement(element, options)
temml.postProcess(element) TemmlDom.PostProcess(element)
temml.definePreamble(tex, options) TemmlRenderer.DefinePreamble(tex, options)
temml.__renderToMathMLTree(tex, options) TemmlRenderer.RenderToMathMLTree(tex, options)
temml.__defineMacro(name, body) TemmlRenderer.DefineMacro(name, macro)
temml.__defineSymbol(mode, group, replace, name, acceptUnicodeChar) TemmlRenderer.DefineSymbol(mode, group, replace, name, acceptUnicodeChar)
temml.__parse(tex, options) not public
temml.version TemmlRenderer.Version
temml.ParseError ParseError

TemmlRenderer, TemmlOptions, and ParseError are in the Temml package and namespace. TemmlDom is in the Temml.AngleSharp package, namespace Temml.Dom, and works on AngleSharp elements.

JavaScript C#
displayMode DisplayMode
annotate Annotate
leqno Leqno
throwOnError ThrowOnError
errorColor ErrorColor
macros Macros, a TemmlMacroDictionary
wrap: "none", "tex", "=" Wrap = TemmlWrap.None, TemmlWrap.Tex, TemmlWrap.Equals
xml Xml
colorIsTextColor ColorIsTextColor
strict Strict
trust: true Trust = true
trust: (context) => ... TrustHandler = context => ...
maxSize: [em, pt] MaxSize = (em, pt)
maxExpand MaxExpand, an int

Auto-render options (delimiters, fences, ignoredTags, ignoredClasses, errorCallback, preProcess) are properties of TemmlAutoRenderOptions, in PascalCase. See DOM and auto-render.

  • There is nothing to include for mhchem, physics, and texvc. They are always available, as in upstream’s temml.cjs.
  • copy-tex is a browser clipboard script and is not ported. You can still serve upstream’s file; it needs Annotate.
  • The stylesheets and Temml.woff2 are embedded in the package. See Styles and fonts.
  • MaxExpand is an int. Where upstream code passes Infinity, pass int.MaxValue.

If a build step or a server called Temml through Node.js only to turn TeX into MathML, RenderToString replaces that call.

MIT · Copyright 2020 Ron Kok · unofficial community port of Temml