diff --git a/tools/server/public_simplechat/typemd.mjs b/tools/server/public_simplechat/typemd.mjs
index ed57b64d18..a7f6017568 100644
--- a/tools/server/public_simplechat/typemd.mjs
+++ b/tools/server/public_simplechat/typemd.mjs
@@ -56,22 +56,24 @@ export class MarkDown {
if (matchUnOrdered != null) {
let sList = 'none'
let listLvl = 0
+ let curOffset = matchUnOrdered[1].length
if (this.in.list.offsets.length == 0) {
sList = 'same'
- this.in.list.offsets.push(matchUnOrdered[1].length)
+ this.in.list.offsets.push(curOffset)
listLvl = this.in.list.offsets.length // ie 1
this.html += "
\n"
} else {
- if (this.in.list.offsets[this.in.list.offsets.length-1] < matchUnOrdered[1].length){
+ let lastOffset = this.in.list.offsets[this.in.list.offsets.length-1];
+ if (lastOffset < curOffset){
sList = 'same'
- this.in.list.offsets.push(matchUnOrdered[1].length)
+ this.in.list.offsets.push(curOffset)
listLvl = this.in.list.offsets.length
this.html += "\n"
- } else if (this.in.list.offsets[this.in.list.offsets.length-1] == matchUnOrdered[1].length){
+ } else if (lastOffset == curOffset){
sList = 'same'
} else {
sList = 'same'
- while (this.in.list.offsets[this.in.list.offsets.length-1] > matchUnOrdered[1].length) {
+ while (lastOffset > curOffset) {
this.in.list.offsets.pop()
this.html += `
\n`
if (this.in.list.offsets.length == 0) {