Fork me on GitHub






Return HTML markup representing this span, its style, classes and children.



coalesce(spans: Span[]): Span[]privatestatic

Attempts to coalesce (merge) spans, for example consecutive text spans. Return a new tree with coalesced spans.

spans : Span[]
: Span[]   

coalesced tree

exports.makeHlist(spans: Span | Span[], classes: string)privatestatic

spans : Span | Span[]
classes : string

exports.makeSpan(content: string | Span | Span[], classes: string)privatestatic

Make an element made of a sequence of children with classes

content : string | Span | Span[]

the items 'contained' by this node

classes : string

list of classes attributes associated with this node

exports.makeVlist(context: Context, elements: Array.<(number|Span)>, pos: string, posData: number)privatestatic

Create a new span of type vlist, a set of vertically stacked items

context : Context
elements : Array.<(number|Span)>

An array of Span and integer. The integer can be either some kerning information or the value of an individual shift of the preceding child if in 'individualShift' mode

pos : string

The method that will be used to position the elements in the vlist.

One of:

  • "individualShift": each child must be followed by a number indicating how much to shift it (i.e. moved downwards)
  • "top": posData specifies the topmost point of the vlist (>0 move up)
  • "bottom": posData specifies the bottommost point of the vlist (>0 move down)
  • "shift": the baseline of the vlist will be positioned posData away from the baseline of the first child. (>0 moves down)

posData : number

makeFontSizer(): Spanprivatestatic

Makes an element placed in each of the vlist elements to ensure that each element has the same max font size. To do this, we create a zero-width space with the correct font size. // * Note: without this, even when fontSize = 0, the fraction bar is no // * longer positioned correctly

: Span   

makeSpanOfType(type: string, content: string | Span[], classes: string)privatestatic

type : string

One of 'mbin', 'mop', 'mord', 'mrel' 'mclose', 'mpunct', 'minner'

content : string | Span[]

A string or an array of other Spans

classes : string

CSS classes decorating this span See for a thorough description of the TeXt atom type and their relevance to proper kerning.

makeSymbol(fontFamily: string, symbol: string, classes: string)privatestatic

fontFamily : string
symbol : string
classes : string

toString(arg: any[] | string | number): stringprivatestatic

Return a string made up of the concatenated arguments. Each arguments can be either a string, which is unchanged, or a number, which is converted to a string with at most 5 fractional digits.

arg : any[] | string | number
: string   

makeSVG(body: Span, svgMarkup: string)privateinner

Add some SVG markup to be overlaid on top of the span

body : Span
svgMarkup : string