Methods
accumulateLevelFromList(rawIROfMarkdown) → {Array.<IRElement>}
- Source:
Realign children nodes to orderedList and bulletList
Parameters:
Name | Type | Description |
---|---|---|
rawIROfMarkdown |
Array | the array of IRElement to look into collapsing |
Returns:
an array of IRElement
- Type
- Array.<IRElement>
accumulateLevelFromList(rawIROfMarkdown) → {Array.<IRElement>}
- Source:
Realign children nodes to orderedList and bulletList
Parameters:
Name | Type | Description |
---|---|---|
rawIROfMarkdown |
Array | the array of IRElement to look into collapsing |
Returns:
an array of IRElement
- Type
- Array.<IRElement>
addTypeToNode(adfNodeToAttachTo, adfType, typeParams) → {Node}
- Source:
Adding a Top-Level ADF element
Parameters:
Name | Type | Description |
---|---|---|
adfNodeToAttachTo |
Node | ADF node to attach this element to |
adfType |
String | ADF Type of the element we want to attach |
typeParams |
String | extra params for special top-level nodes |
Returns:
the node added
- Type
- Node
addTypeToNode(adfNodeToAttachTo, adfType, typeParams) → {Node}
- Source:
Adding a Top-Level ADF element
Parameters:
Name | Type | Description |
---|---|---|
adfNodeToAttachTo |
Node | ADF node to attach this element to |
adfType |
String | ADF Type of the element we want to attach |
typeParams |
String | extra params for special top-level nodes |
Returns:
the node added
- Type
- Node
attachItemNode(nodeToAttachTo, rawText)
- Source:
Adding a non-top-level ADF node
Parameters:
Name | Type | Description |
---|---|---|
nodeToAttachTo |
Node | ADF Node to attach to |
rawText |
String | text content of the node to add |
attachItemNode(nodeToAttachTo, rawText)
- Source:
Adding a non-top-level ADF node
Parameters:
Name | Type | Description |
---|---|---|
nodeToAttachTo |
Node | ADF Node to attach to |
rawText |
String | text content of the node to add |
attachTextToNodeRaw(nodeToAttachTo, textToAttach)
- Source:
Attach a raw simple text node to the parent
Parameters:
Name | Type | Description |
---|---|---|
nodeToAttachTo |
Node | ADF node to attach to |
textToAttach |
String | text to use for the Text node |
attachTextToNodeRaw(nodeToAttachTo, textToAttach)
- Source:
Attach a raw simple text node to the parent
Parameters:
Name | Type | Description |
---|---|---|
nodeToAttachTo |
Node | ADF node to attach to |
textToAttach |
String | text to use for the Text node |
attachTextToNodeSliceEmphasis(parentNode, textToEmphasis)
- Source:
Parse a string character per character to find emphasis patterns This is a very "manual" way to do it, but it provides the most efficient result
Parameters:
Name | Type | Description |
---|---|---|
parentNode |
Node | ADF Node to attach the suite of Text node to |
textToEmphasis |
String | text to parse for emphasis parsing |
attachTextToNodeSliceEmphasis(parentNode, textToEmphasis)
- Source:
Parse a string character per character to find emphasis patterns This is a very "manual" way to do it, but it provides the most efficient result
Parameters:
Name | Type | Description |
---|---|---|
parentNode |
Node | ADF Node to attach the suite of Text node to |
textToEmphasis |
String | text to parse for emphasis parsing |
buildTreeFromLevelMap(levelsMap) → {Array.<IRTreeNode>}
- Source:
Map all element to their level in an array of level
Parameters:
Name | Type | Description |
---|---|---|
levelsMap |
Array | the level array of array of IRElement |
Returns:
tree of IRElements and their children
- Type
- Array.<IRTreeNode>
buildTreeFromLevelMap(levelsMap) → {Array.<IRTreeNode>}
- Source:
Map all element to their level in an array of level
Parameters:
Name | Type | Description |
---|---|---|
levelsMap |
Array | the level array of array of IRElement |
Returns:
tree of IRElements and their children
- Type
- Array.<IRTreeNode>
buildTreeFromMarkdown(rawTextMarkdown) → {Array.<IRElement>}
- Source:
Implement markdown greediness and collapsing of subnode, generate the final node tree representing the IRElement topology
Parameters:
Name | Type | Description |
---|---|---|
rawTextMarkdown |
Array.<String> | array of expression to parse and handle |
Returns:
an array of IRElement
- Type
- Array.<IRElement>
buildTreeFromMarkdown(rawTextMarkdown) → {Array.<IRElement>}
- Source:
Implement markdown greediness and collapsing of subnode, generate the final node tree representing the IRElement topology
Parameters:
Name | Type | Description |
---|---|---|
rawTextMarkdown |
Array.<String> | array of expression to parse and handle |
Returns:
an array of IRElement
- Type
- Array.<IRElement>
collapseBlockquote(rawIROfMarkdown) → {Array.<IRElement>}
- Source:
Blockquote start with each line identify with a caret. Any interruption (line break) create a new blockquote
Parameters:
Name | Type | Description |
---|---|---|
rawIROfMarkdown |
Array | the array of IRElement to look into collapsing |
Returns:
an array of IRElement
- Type
- Array.<IRElement>
collapseBlockquote(rawIROfMarkdown) → {Array.<IRElement>}
- Source:
Blockquote start with each line identify with a caret. Any interruption (line break) create a new blockquote
Parameters:
Name | Type | Description |
---|---|---|
rawIROfMarkdown |
Array | the array of IRElement to look into collapsing |
Returns:
an array of IRElement
- Type
- Array.<IRElement>
collapseCodeBloc(rawIROfMarkdown) → {Array.<IRElement>}
- Source:
CodeBlock swallow all text until they are closed, so we collapsed all paragraph into them When a code block is open, it should be closed by a triple caret, everything in between is code
Parameters:
Name | Type | Description |
---|---|---|
rawIROfMarkdown |
Array | the array of IRElement to look into collapsing |
Returns:
an array of IRElement
- Type
- Array.<IRElement>
collapseCodeBloc(rawIROfMarkdown) → {Array.<IRElement>}
- Source:
CodeBlock swallow all text until they are closed, so we collapsed all paragraph into them When a code block is open, it should be closed by a triple caret, everything in between is code
Parameters:
Name | Type | Description |
---|---|---|
rawIROfMarkdown |
Array | the array of IRElement to look into collapsing |
Returns:
an array of IRElement
- Type
- Array.<IRElement>
collapseParagraph(rawIROfMarkdown) → {Array.<IRElement>}
- Source:
Heading is an exception, otherwise non-empty line aggregate in the parent element For all other type, following a markdown with any paragraph of text is considered a continuation, so we aggregate all subsequent text into the same parent element (paragraph, list item, ...)
Parameters:
Name | Type | Description |
---|---|---|
rawIROfMarkdown |
Array | the array of IRElement to look into collapsing |
Returns:
an array of IRElement
- Type
- Array.<IRElement>
collapseParagraph(rawIROfMarkdown) → {Array.<IRElement>}
- Source:
Heading is an exception, otherwise non-empty line aggregate in the parent element For all other type, following a markdown with any paragraph of text is considered a continuation, so we aggregate all subsequent text into the same parent element (paragraph, list item, ...)
Parameters:
Name | Type | Description |
---|---|---|
rawIROfMarkdown |
Array | the array of IRElement to look into collapsing |
Returns:
an array of IRElement
- Type
- Array.<IRElement>
convertDecorationLevelToMark(decorationLevelToConvert, addStrikethrough)
- Source:
Convert a "decoration level" (bit swap) to an actual ADF Mark for the text
Parameters:
Name | Type | Description |
---|---|---|
decorationLevelToConvert |
Number | decoration level follow the convention: 0 => no decoration 1 => italic 2 => bold 3 => bold and italic |
addStrikethrough |
Boolean | is strikethrough active? |
convertDecorationLevelToMark(decorationLevelToConvert, addStrikethrough)
- Source:
Convert a "decoration level" (bit swap) to an actual ADF Mark for the text
Parameters:
Name | Type | Description |
---|---|---|
decorationLevelToConvert |
Number | decoration level follow the convention: 0 => no decoration 1 => italic 2 => bold 3 => bold and italic |
addStrikethrough |
Boolean | is strikethrough active? |
createLevelList(rawIROfMarkdown) → {Array.<Number>}
- Source:
Build an array of all the different level (defined by the lists) we have to manage and their corresponding textPosition
Parameters:
Name | Type | Description |
---|---|---|
rawIROfMarkdown |
Array | the array of IRElement to look into collapsing |
Returns:
an array of the textPosition for each level
- Type
- Array.<Number>
createLevelList(rawIROfMarkdown) → {Array.<Number>}
- Source:
Build an array of all the different level (defined by the lists) we have to manage and their corresponding textPosition
Parameters:
Name | Type | Description |
---|---|---|
rawIROfMarkdown |
Array | the array of IRElement to look into collapsing |
Returns:
an array of the textPosition for each level
- Type
- Array.<Number>
fillADFNodesWithMarkdown(currentParentNode, currentArrayOfNodesOfSameIndent)
- Source:
Browse the tree recursively to add each node to the ADF Document It also treat special cases between top-level node and generic ones
Parameters:
Name | Type | Description |
---|---|---|
currentParentNode |
Document | ADF document to add to |
currentArrayOfNodesOfSameIndent |
IRTreeNode |
fillADFNodesWithMarkdown(currentParentNode, currentArrayOfNodesOfSameIndent)
- Source:
Browse the tree recursively to add each node to the ADF Document It also treat special cases between top-level node and generic ones
Parameters:
Name | Type | Description |
---|---|---|
currentParentNode |
Document | ADF document to add to |
currentArrayOfNodesOfSameIndent |
IRTreeNode |
mapIRToLevels(rawIROfMarkdown, levelsPosition) → {Array.<IRTreeNode>}
- Source:
Map all element to their level in an array of level
Parameters:
Name | Type | Description |
---|---|---|
rawIROfMarkdown |
Array | the array of IRElement to look into mapping |
levelsPosition |
Array | the list of level's textPosition to use |
Returns:
an array of IRTreeNode
- Type
- Array.<IRTreeNode>
mapIRToLevels(rawIROfMarkdown, levelsPosition) → {Array.<IRTreeNode>}
- Source:
Map all element to their level in an array of level
Parameters:
Name | Type | Description |
---|---|---|
rawIROfMarkdown |
Array | the array of IRElement to look into mapping |
levelsPosition |
Array | the list of level's textPosition to use |
Returns:
an array of IRTreeNode
- Type
- Array.<IRTreeNode>
matchBlockQuote(lineToMatch) → {IRElement}
- Source:
Match a markdown blockquote
Parameters:
Name | Type | Description |
---|---|---|
lineToMatch |
actual expression to match |
Returns:
| null if the expression doesn't match
- Type
- IRElement
matchBlockQuote(lineToMatch) → {IRElement}
- Source:
Match a markdown blockquote
Parameters:
Name | Type | Description |
---|---|---|
lineToMatch |
actual expression to match |
Returns:
| null if the expression doesn't match
- Type
- IRElement
matchCodeBlock(lineToMatch) → {IRElement}
- Source:
Match a markdown code block
Parameters:
Name | Type | Description |
---|---|---|
lineToMatch |
actual expression to match |
Returns:
| null if the expression doesn't match
- Type
- IRElement
matchCodeBlock(lineToMatch) → {IRElement}
- Source:
Match a markdown code block
Parameters:
Name | Type | Description |
---|---|---|
lineToMatch |
actual expression to match |
Returns:
| null if the expression doesn't match
- Type
- IRElement
matchDivider(lineToMatch) → {IRElement}
- Source:
Match a markdown divider
Parameters:
Name | Type | Description |
---|---|---|
lineToMatch |
actual expression to match |
Returns:
| null if the expression doesn't match
- Type
- IRElement
matchDivider(lineToMatch) → {IRElement}
- Source:
Match a markdown divider
Parameters:
Name | Type | Description |
---|---|---|
lineToMatch |
actual expression to match |
Returns:
| null if the expression doesn't match
- Type
- IRElement
matchHeader(lineToMatch) → {IRElement}
- Source:
Matching of the markdown header
Parameters:
Name | Type | Description |
---|---|---|
lineToMatch |
actual expression to match |
Returns:
| null if the expression doesn't match
- Type
- IRElement
matchHeader(lineToMatch) → {IRElement}
- Source:
Matching of the markdown header
Parameters:
Name | Type | Description |
---|---|---|
lineToMatch |
actual expression to match |
Returns:
| null if the expression doesn't match
- Type
- IRElement
matchList(lineToMatch) → {IRElement}
- Source:
Matching of a markdown list
Parameters:
Name | Type | Description |
---|---|---|
lineToMatch |
actual expression to match |
Returns:
| null if the expression doesn't match
- Type
- IRElement
matchList(lineToMatch) → {IRElement}
- Source:
Matching of a markdown list
Parameters:
Name | Type | Description |
---|---|---|
lineToMatch |
actual expression to match |
Returns:
| null if the expression doesn't match
- Type
- IRElement
matchParagraph(lineToMatch) → {IRElement}
- Source:
Match a markdown paragraph
Parameters:
Name | Type | Description |
---|---|---|
lineToMatch |
actual expression to match |
Returns:
| null if the expression doesn't match
- Type
- IRElement
matchParagraph(lineToMatch) → {IRElement}
- Source:
Match a markdown paragraph
Parameters:
Name | Type | Description |
---|---|---|
lineToMatch |
actual expression to match |
Returns:
| null if the expression doesn't match
- Type
- IRElement
parseMarkdownLinetoIR(markdownLineTextWithTabs) → {IRElement}
- Source:
Parse markdown into an Intermediate representation
Parameters:
Name | Type | Description |
---|---|---|
markdownLineTextWithTabs |
an array of markdown expression to process |
Returns:
an intermediate representation of the markdown element
- Type
- IRElement
parseMarkdownLinetoIR(markdownLineTextWithTabs) → {IRElement}
- Source:
Parse markdown into an Intermediate representation
Parameters:
Name | Type | Description |
---|---|---|
markdownLineTextWithTabs |
an array of markdown expression to process |
Returns:
an intermediate representation of the markdown element
- Type
- IRElement
sliceEmoji(rawText) → {Array.<String>}
- Source:
Match text content with and ADF emoji type
Parameters:
Name | Type | Description |
---|---|---|
rawText |
String | the text content to try to match |
Returns:
the different slice matching an emoji style
- Type
- Array.<String>
sliceEmoji(rawText) → {Array.<String>}
- Source:
Match text content with and ADF emoji type
Parameters:
Name | Type | Description |
---|---|---|
rawText |
String | the text content to try to match |
Returns:
the different slice matching an emoji style
- Type
- Array.<String>
sliceInLineCode(rawText) → {Array.<String>}
- Source:
Match text content with and ADF inline type
Parameters:
Name | Type | Description |
---|---|---|
rawText |
String | the text content to try to match |
Returns:
the different slice matching an inline style
- Type
- Array.<String>
sliceInLineCode(rawText) → {Array.<String>}
- Source:
Match text content with and ADF inline type
Parameters:
Name | Type | Description |
---|---|---|
rawText |
String | the text content to try to match |
Returns:
the different slice matching an inline style
- Type
- Array.<String>
sliceLink(rawText) → {Array.<String>}
- Source:
Match text content with and ADF link type
Parameters:
Name | Type | Description |
---|---|---|
rawText |
String | the text content to try to match |
Returns:
the different slice matching a link style
- Type
- Array.<String>
sliceLink(rawText) → {Array.<String>}
- Source:
Match text content with and ADF link type
Parameters:
Name | Type | Description |
---|---|---|
rawText |
String | the text content to try to match |
Returns:
the different slice matching a link style
- Type
- Array.<String>
sliceOneMatchFromRegexp(rawText, typeTag, regexpToSliceWith) → {Array.<String>}
- Source:
Match text content with and regular expression with one match
Parameters:
Name | Type | Description |
---|---|---|
rawText |
String | the text content to try to match |
typeTag |
String | the ADF Type to return if it matches |
regexpToSliceWith |
RegExp | the regexp with a match group and a non-match group to use |
Returns:
the different slice matching the specified regexp
- Type
- Array.<String>
sliceOneMatchFromRegexp(rawText, typeTag, regexpToSliceWith) → {Array.<String>}
- Source:
Match text content with and regular expression with one match
Parameters:
Name | Type | Description |
---|---|---|
rawText |
String | the text content to try to match |
typeTag |
String | the ADF Type to return if it matches |
regexpToSliceWith |
RegExp | the regexp with a match group and a non-match group to use |
Returns:
the different slice matching the specified regexp
- Type
- Array.<String>
Type Definitions
IRElement
- Source:
Properties:
Name | Type | Description |
---|---|---|
adfType |
number | ADF type of the expression |
textPosition |
number | the actual start of the text (adfType dependent) |
textToEmphasis |
string | actual text of the element (adfType dependent) |
typeParam |
string | extra parameters adfType dependent |
nodeAttached |
IRElement | an attached code block to a list |
Type:
- Object
IRElement
- Source:
Properties:
Name | Type | Description |
---|---|---|
adfType |
number | ADF type of the expression |
textPosition |
number | the actual start of the text (adfType dependent) |
textToEmphasis |
string | actual text of the element (adfType dependent) |
typeParam |
string | extra parameters adfType dependent |
nodeAttached |
IRElement | an attached code block to a list |
Type:
- Object
IRTreeNode
- Source:
Properties:
Name | Type | Description |
---|---|---|
node |
IRElement | intermediate representation of the markdown element |
children |
Array.<IRElement> | the list of children attach to that node |
indexOfList |
Number | the index in the list of expression |
Type:
- Object
IRTreeNode
- Source:
Properties:
Name | Type | Description |
---|---|---|
node |
IRElement | intermediate representation of the markdown element |
children |
Array.<IRElement> | the list of children attach to that node |
indexOfList |
Number | the index in the list of expression |
Type:
- Object