数组排序
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user