SimpleChatTCRV:Markdown:Lists - handle split lines to an extent
If a split line is found which remains within the constraints of the preceding list item, then dont unwind the list, rather for now add the split line as a new item at the same level.
This commit is contained in:
parent
b4be1cb4b8
commit
226dc793b1
|
|
@ -87,9 +87,24 @@ export class MarkDown {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.html += `<li>${matchUnOrdered[3]}</li>\n`
|
||||
return true
|
||||
} else {
|
||||
if (this.in.list.offsets.length > 0) {
|
||||
if (line.trim().length == 0) {
|
||||
return true
|
||||
}
|
||||
let matchOffset = line.match(/^([ ]*)(.*)$/);
|
||||
if (matchOffset == null) {
|
||||
return false
|
||||
}
|
||||
let lastOffset = this.in.list.offsets[this.in.list.offsets.length-1];
|
||||
if (matchOffset[1].length < lastOffset) {
|
||||
return false
|
||||
}
|
||||
this.html += `<li>${matchOffset[2]}</li>\n`
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
|
@ -197,9 +212,7 @@ export class MarkDown {
|
|||
if (this.process_list_unordered(line)) {
|
||||
return
|
||||
}
|
||||
if (line.trim().length > 0) {
|
||||
this.unwind_list()
|
||||
}
|
||||
this.unwind_list()
|
||||
this.html += `<p>${line}</p>`
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue