Type

Type

new Type(match)

A base type for all line types

Example
new Type(XRegExp.exec('Foo', XRegExp('(?<source>)')));
Parameters
Name Type Description
match object

The result of an XRegExp match

Properties
Name Type Description
source string

The original native source

content string

The content of the line

Members

(static) groupType

Properties:
Name Type Description
groupType string

The type of group this line belongs to

(static) markdownPattern

Properties:
Name Type Description
markdownPattern XRegExp

An XRegExp object that matches the Markdown form of this line type

(static) nativePattern

Properties:
Name Type Description
nativePattern XRegExp

An XRegExp object that matches the native form of this line type

(static) type

Properties:
Name Type Description
type string

A human-readable name for this type

(static) typeKey

Properties:
Name Type Description
typeKey string

A short, typically one-character key to denote this line type

content

Properties:
Name Type Description
content string

The human-readable content of the line

groupType

Properties:
Name Type Description
groupType string

The type of group this line belongs to

See:

isNesting

Properties:
Name Type Description
isNesting boolean

Whether this line is nestable in groups

isSummarized

Properties:
Name Type Description
isSummarized boolean

Whether this line is included in a Canvas document summary

source

Properties:
Name Type Description
source string

The original native source of this line

type

Properties:
Name Type Description
type string

A human-readable name for this type

See:

typeKey

Properties:
Name Type Description
typeKey string

A short, typically one-character key to denote this line type

See:

Methods

(static) buildNative(contentopt, metaopt)

Build a Canvas Native string of this type from a given content string and meta data object.

Parameters
Name Type Attributes Default Description
content string <optional>
''

The readable content for the native line

meta object <optional>
{}

The metadata for the native line

(static) matchMarkdown(markdown, contextopt, nullable) → (nullable) {object}

Match a Markdown string and return a line of this type if it matches.

Parameters
Name Type Attributes Default Description
markdown string

The Markdown to possibly match this line against

context object <optional>
<nullable>
{}

A context object containing the surrounding context of this line

Returns

An object representing the match information for this line

Type
object

(static) matchNative(native) → (nullable) {object}

Match a native string and return a line of this type if it matches.

Parameters
Name Type Description
native string

The native string to possibly match this line against

Returns

An object representing the match information for this line

Type
object

toJSON() → {object}

Returns

An object representing this line in a JSON-serializable form

Type
object

toMarkdown(prev, next, contextopt) → {string}

Parameters
Name Type Attributes Default Description
prev Type

The line before the line being converted to Markdown

next Type

The line after the line being converted to Markdown

context object <optional>
{}

Contextual information for the Markdown conversion

Returns

The Markdown representation of this line

Type
string