Fork me on GitHub


core/span. Span

new Span(content: string | Span | Span[], classes: string): voidprivate

A span is the most elementary element that can be rendered. It is composed of an optional body of text and an optional list of children (other spans). Each span can be decorated with CSS classes and style attributes.

content : string | Span | Span[]

the items 'contained' by this node

classes : string

list of classes attributes associated with this node

: void   
type : string

For example, 'command', 'mrel', etc...

classes : string

A string of space separated CSS classes associated with this element

children : Span[]

An array, potentially empty, of spans which this span encloses

body : string

Content of this span. Can be empty.

style : [string]:any

A set of key/value pairs specifying CSS properties associated with this element.

height : number

The measurement from baseline to top, in em.

depth : number

The measurement from baseline to bottom, in em.


setStyle(prop: string, …value: string | number): stringprivate

Set the value of a CSS property associated with this span. For example, setStyle('border-right', 5.6, 'em');

prop : string

the CSS property to set

value : string | number repeatable

a series of strings and numbers that will be concatenated.

: string   

toMarkup(hskip?: number, hscale?: number): stringprivate

Generate the HTML markup to represent this span.

hskip : number = 0

Space (in mu, 1/18em) to leave on the left side of the span. Implemented as a Unicode character if possible, a margin-left otherwise.

hscale : number = 1.0

If a value is provided, the margins are scaled by this factor.

: string   

HTML markup

tryCoalesceWith(span: Span): booleanprivate

Can this span be coalesced with 'span'? This is used to 'coalesce' (i.e. group together) a series of spans that are identical except for their value, and to avoid generating redundant spans. That is: '12' -> "12" rather than: "12"

span : Span
: boolean   


Update the dimensions of this node based on its children:

  • height: distance from bottom to top
  • depth: distance from bottom to baseline
  • maxFontSize: