(stream, state)
| 151 | } |
| 152 | |
| 153 | function blockNormal(stream, state) { |
| 154 | var firstTokenOnLine = stream.column() === state.indentation; |
| 155 | var prevLineLineIsEmpty = lineIsEmpty(state.prevLine.stream); |
| 156 | var prevLineIsIndentedCode = state.indentedCode; |
| 157 | var prevLineIsHr = state.prevLine.hr; |
| 158 | var prevLineIsList = state.list !== false; |
| 159 | var maxNonCodeIndentation = (state.listStack[state.listStack.length - 1] || 0) + 3; |
| 160 | |
| 161 | state.indentedCode = false; |
| 162 | |
| 163 | var lineIndentation = state.indentation; |
| 164 | // compute once per line (on first token) |
| 165 | if (state.indentationDiff === null) { |
| 166 | state.indentationDiff = state.indentation; |
| 167 | if (prevLineIsList) { |
| 168 | state.list = null; |
| 169 | // While this list item's marker's indentation is less than the deepest |
| 170 | // list item's content's indentation,pop the deepest list item |
| 171 | // indentation off the stack, and update block indentation state |
| 172 | while (lineIndentation < state.listStack[state.listStack.length - 1]) { |
| 173 | state.listStack.pop(); |
| 174 | if (state.listStack.length) { |
| 175 | state.indentation = state.listStack[state.listStack.length - 1]; |
| 176 | // less than the first list's indent -> the line is no longer a list |
| 177 | } else { |
| 178 | state.list = false; |
| 179 | } |
| 180 | } |
| 181 | if (state.list !== false) { |
| 182 | state.indentationDiff = lineIndentation - state.listStack[state.listStack.length - 1] |
| 183 | } |
| 184 | } |
| 185 | } |
| 186 | |
| 187 | // not comprehensive (currently only for setext detection purposes) |
| 188 | var allowsInlineContinuation = ( |
| 189 | !prevLineLineIsEmpty && !prevLineIsHr && !state.prevLine.header && |
| 190 | (!prevLineIsList || !prevLineIsIndentedCode) && |
| 191 | !state.prevLine.fencedCodeEnd |
| 192 | ); |
| 193 | |
| 194 | var isHr = (state.list === false || prevLineIsHr || prevLineLineIsEmpty) && |
| 195 | state.indentation <= maxNonCodeIndentation && stream.match(hrRE); |
| 196 | |
| 197 | var match = null; |
| 198 | if (state.indentationDiff >= 4 && (prevLineIsIndentedCode || state.prevLine.fencedCodeEnd || |
| 199 | state.prevLine.header || prevLineLineIsEmpty)) { |
| 200 | stream.skipToEnd(); |
| 201 | state.indentedCode = true; |
| 202 | return tokenTypes.code; |
| 203 | } else if (stream.eatSpace()) { |
| 204 | return null; |
| 205 | } else if (firstTokenOnLine && state.indentation <= maxNonCodeIndentation && (match = stream.match(atxHeaderRE)) && match[1].length <= 6) { |
| 206 | state.quote = 0; |
| 207 | state.header = match[1].length; |
| 208 | state.thisLine.header = true; |
| 209 | if (modeCfg.highlightFormatting) state.formatting = "header"; |
| 210 | state.f = state.inline; |
nothing calls this directly
no test coverage detected