diff --git a/src/renderer/App.tsx b/src/renderer/App.tsx
index 275130e..e7a6ada 100644
--- a/src/renderer/App.tsx
+++ b/src/renderer/App.tsx
@@ -61,7 +61,6 @@ const createDecoratedTitleHTML = (text: any) => {
return `
${topBorder}
${middleLine}
${bottomBorder}
`;
// return `${topBorder}
${middleLine}
${bottomBorder}
`;
-
};
marked.setOptions({
@@ -101,49 +100,61 @@ renderer.image = function (href, title, text) {
return `
`;
};
-// let listSinbal="▫️ "
let listSinbal = '🔸';
-
// 有序列表
renderer.list = function (body, ordered, start) {
- // console.log("body,ordered, start", body, ordered, start);
const type = ordered ? 'ol' : 'ul';
- // console.log("type===>", type);
const startatt = ordered && start !== 1 ? ' start="' + start + '"' : '';
- // 正则取值
- // const regex = /▫️\s*(.*?)
/g;
- const regex = /([^<]*)
/g;
- 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(listSinbal));
- // 0️⃣',
- const numbers = ['1️⃣', '2️⃣', '3️⃣', '4️⃣', '5️⃣', '6️⃣', '7️⃣', '8️⃣', '9️⃣', '🔟'];
+
+ // 移除 `` 和 `
` 标签
+ const cleanedBody = body.replace(/<\/?div>/g, '');
+
+ // 正则表达式匹配每个以
结尾的列表项
+ const regex = /([^<]*)
/g;
+ const input = cleanedBody;
+
+ // 正则取值
+ // // const regex = /▫️\s*(.*?)
/g;
+ // const regex = /([^<]*)
/g;
+ // const input = body;
+ // console.log('input--', input);
+
+ const matches = [...input.matchAll(regex)];
+ console.log('matches--', matches);
+ const texts = matches.map((match) => match[1]);
+ console.log('texts===>', texts); // 输出: ["测试111", "测试222", "if"]
+ const newArray = texts.filter((item) => item.includes(listSinbal));
+ 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 ? '
111' : ""}
return value.indexOf(listSinbal) !== -1
? `${
type === 'ol' ? numbers[newArray.indexOf(value)] : listSinbal
}${value.replace(listSinbal, '')}
`
- : `\t${value}
`;
+ : // : `\t${value}
`;
+ ` ┊ ${value}
`;
})
.join('');
- // return `1️⃣`
- // console.log("string===>", string);
-
return `${string}`;
};
+
+
+
+// 示例输入
+const input = `🔸11
🔸22
🔸33`;
+console.log(renderer.list(input, false, 1));
+
// 无序列表 ▫️
renderer.listitem = function (text, task, checked) {
// return `${text}\n`;
return `${listSinbal}${text}
`;
+ return `${listSinbal}${text}\n`;
+
+ // return `${listSinbal}${text}\n`;
+
// return `➖${text}
`;
};
@@ -336,7 +347,7 @@ const Index = () => {
// │ 🆔 hackrobot
// ╰────────────────╯
💬 随时欢迎聊天`;
- let contactMe = `➖➖➖➖➖\n💬 后台发送关键词: 加群`;
+ let contactMe = `
➖➖➖➖➖
💬 欢迎交流
后台私信发送『关键词』: 加群`;
// setmarkText(value);
setmarkText(value + contactMe);