SectionManager

new SectionManager(cm, preview)

Parameters:
Name Type Description
cm CodeMirror

codemirror

preview Preview

preview

Methods

_addNewSection(start, end)

_addNewSection
add new section

Parameters:
Name Type Description
start number

initial start line number

end number

initial end line number

_doFollowedLinesHaveCodeBlockEnd(lineIndex, lineLength) → {boolean}

_doFollowedLinesHaveCodeBlockEnd
Check if follow lines have codeblock end

Parameters:
Name Type Description
lineIndex number

current index

lineLength number

line length

Returns:
boolean -

result

_eachLineState(iteratee)

_eachLineState
iterate codemiror lines, callback function parameter pass line type and line number

Parameters:
Name Type Description
iteratee function

callback function

_getPreviewSections() → {Array.<array>}

_getPreviewSections
get preview html section group to make section

Returns:
Array.<array> -

element node array

_isAtxHeader(string) → {boolean}

_isAtxHeader
Check if passed string have atx header

Parameters:
Name Type Description
string string

string to check

Returns:
boolean -

result

_isCodeBlockEnd(string) → {boolean}

_isCodeBlockEnd
Check if passed string have code block end

Parameters:
Name Type Description
string string

string to check

Returns:
boolean -

result

_isCodeBlockStart(string) → {boolean}

_isCodeBlockStart
Check if passed string have code block start

Parameters:
Name Type Description
string string

string to check

Returns:
boolean -

result

_isSeTextHeader(lineString, nextLineString) → {boolean}

_isSeTextHeader

Parameters:
Name Type Description
lineString string

current line string

nextLineString string

next line string

Returns:
boolean -

result

_isTable(lineString, nextLineString) → {boolean}

_isTable
Check if passed string have table

Parameters:
Name Type Description
lineString string

current line string

nextLineString string

next line string

Returns:
boolean -

result

_isTableAligner(string) → {boolean}

_isTableAligner
Check if passed string have table align code

Parameters:
Name Type Description
string string

string to check

Returns:
boolean -

result

_isTableCode(string) → {boolean}

_isTableCode
Check if passed string have table code

Parameters:
Name Type Description
string string

string to check

Returns:
boolean -

result

_makeSectionData(start, end) → {object}

_makeSectionData
make default section object

Parameters:
Name Type Description
start number

initial start line number

end number

initial end line number

Returns:
object -

section object

_matchPreviewSectionsWithSectionlist(sections)

_matchPreviewSectionsWithSectionlist
match section list with preview section element

Parameters:
Name Type Description
sections Array.<HTMLNode>

section nodes

_updateCurrentSectionEnd(end)

_updateCurrentSectionEnd
update current section's end line number

Parameters:
Name Type Description
end number

end value to update

getSectionList() → {Array.<object>}

getSectionList
return section list

Returns:
Array.<object> -

section object list

makeSectionList()

makeSectionList
make section list

sectionByLine(line) → {object}

_sectionByLine
get section by markdown line

Parameters:
Name Type Description
line number

markdown editor line number

Returns:
object -

section

sectionMatch()

sectionMatch
make preview sections then match section list with preview section element