数组排序

This commit is contained in:
hackrobot
2024-05-13 18:07:30 +08:00
parent 05e3dbb678
commit 45027cc520

View File

@@ -57,18 +57,22 @@ renderer.list = function (body, ordered, start) {
const input = body;
const matches = [...input.matchAll(regex)];
const texts = matches.map((match) => match[1]);
// 不含▫️的元素数量
// const diffcCount=texts.length-texts.filter(item => item.includes('▫️')).length;
console.log("texts===>", texts); // 输出: ["测试111", "测试222", "if"]
const newArray = texts.filter(item => item.includes('▫️'));
// 0⃣',
const numbers = ["1⃣", "2⃣", "3⃣", "4⃣", "5⃣", "6⃣", "7⃣", "8⃣", "9⃣", "🔟"];
const string = texts
.map((value, index) => {
console.log("value, index==>", value, index);
// ${ value.indexOf("▫️ ") === -1 ? '<br/><span>111</sapn>' : ""}
return value.indexOf("▫️ ") !== -1 ?`<div>${type === "ol" ? numbers[index] : "▫️ "}${value.replace('▫️ ','')} </div>`:`<div style="white-space:pre;">\t${value}</div>`;
return value.indexOf("▫️ ") !== -1 ?`<div>${type === "ol" ? numbers[newArray.indexOf(value)] : "▫️ "}${value.replace('▫️ ','')} </div>`:`<div style="white-space:pre;">\t${value}</div>`;
})
.join("");
// return `1⃣`
console.log("string===>", string);
return `${string}`;
};
@@ -137,6 +141,9 @@ const markTextStr = marked(
恶魔女哪里的请
2. 你好啊
3. iefw4t43t43t
永远不要相信一个
---
相信我
`
);
// export default class Index extends Component {