Chunk

Type: Class

Represents a single 'chunk' of incompletely annotated text

Constructor arguments

  1. text

    (Required)

    Type: String

    The type of text the chunk represents

Properties

text

Type: String

The text content of this chunk. Mutate it in an input processor.

Methods

addFallback

Type: Function

Set the fallBackfunction, used when converting back from the annotated text for a plain text import Add a fallbackFunction undoing every text change done. ie: originalText = '- A list item'

Other

// Execute a text change here, removing the '- '
text = 'A list item'

// Add the '- ' back when falling back to plain text
addFallback(function (chunk){ chunk.text = '- ' + chunk.text});

Arguments

addLabel

Type: Function

Add a label for this chunk

Arguments

fallback

Type: Function

Fallback to the original version of the text, used for falling back to a plain text import import { FontoNode } from 'fontoxml-dom-utils/src/types'; import { Chunk } from 'fontoxml-pipelined-importer/src/chunks/Chunk';

Returns