forked from JetBrains/markdown
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMarkerBlockProvider.kt
30 lines (25 loc) · 1.12 KB
/
MarkerBlockProvider.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package org.intellij.markdown.parser.markerblocks
import org.intellij.markdown.parser.LookaheadText
import org.intellij.markdown.parser.MarkerProcessor
import org.intellij.markdown.parser.ProductionHolder
import org.intellij.markdown.parser.constraints.MarkdownConstraints
interface MarkerBlockProvider<T : MarkerProcessor.StateInfo> {
fun createMarkerBlocks(pos: LookaheadText.Position,
productionHolder: ProductionHolder,
stateInfo: T): List<MarkerBlock>
fun interruptsParagraph(pos: LookaheadText.Position, constraints: MarkdownConstraints): Boolean
companion object {
fun isStartOfLineWithConstraints(pos: LookaheadText.Position, constraints: MarkdownConstraints): Boolean {
return pos.offsetInCurrentLine == constraints.getCharsEaten(pos.currentLine)
}
fun passSmallIndent(text: CharSequence): Int {
var offset = 0
repeat(3) {
if (offset < text.length && text[offset] == ' ') {
offset++
}
}
return offset
}
}
}