diff --git a/src/pages/index/index.jsx b/src/pages/index/index.jsx
index a9569b2..8589040 100644
--- a/src/pages/index/index.jsx
+++ b/src/pages/index/index.jsx
@@ -49,19 +49,27 @@ renderer.image = function (href, title, text) {
renderer.list = function (body, ordered, start) {
console.log("body,ordered, start", body, ordered, start);
const type = ordered ? "ol" : "ul";
- console.log("type===>",type)
+ console.log("type===>", type);
const startatt = ordered && start !== 1 ? ' start="' + start + '"' : "";
// 正则取值
- const regex = /▫️\s*(.*?)
/g;
+ // const regex = /▫️\s*(.*?)
/g;
+ const regex = /([^<]*)
/g;
const input = body;
const matches = [...input.matchAll(regex)];
const texts = matches.map((match) => match[1]);
- console.log(texts); // 输出: ["测试111", "测试222", "if"]
+ console.log("texts===>", texts); // 输出: ["测试111", "测试222", "if"]
// 0️⃣',
- const numbers = [ '1️⃣', '2️⃣', '3️⃣', '4️⃣', '5️⃣', '6️⃣', '7️⃣', '8️⃣', '9️⃣', '🔟'];
- const string= texts.map((value,index) => `
${type==='ol'?numbers[index]:'▫️ '}${value}
`).join('');
+ 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("▫️ ") !== -1 ?`${type === "ol" ? numbers[index] : "▫️ "}${value.replace('▫️ ','')}
`:`\t${value}
`;
+ })
+ .join("");
// return `1️⃣`
- return `${string}`
+ console.log("string===>", string);
+ return `${string}`;
};
// 无序列表 ▫️
@@ -92,6 +100,11 @@ renderer.hr = function () {
return "
➖➖➖➖➖
";
};
+// 内联样式,使用直角引号「」
+renderer.codespan = function (text) {
+ return `「${text}」`;
+};
+
// 引用符号
renderer.blockquote = function (quote) {
console.log("quote", quote);
@@ -102,7 +115,8 @@ renderer.blockquote = function (quote) {
var content = match[1]; // 获取第一个捕获组的内容
console.log(content);
}
- return `👉${content}`;
+ //
+ return `\t👉${content} `;
};
marked.use({ renderer });
@@ -111,17 +125,18 @@ marked.use({ renderer });
const markTextStr = marked(
`
## 标题
- >测试
- 随便测试普通的文本,要不要来个内敛的字符串
+ > 测试引用桔子的样子
+随便测试普通的文本,要不要来个\`内敛\`的字符串
---
- 无序列表1
-- 无序列表2
-- [ ] 任务列表
-- [x] 完成任务
+ 个人有看看
+ - 无序列表2
+ - [ ] 任务列表
+ - [x] 完成任务
1. 测试111
- 2. 测试222
+ 恶魔女哪里的请
+ 2. 你好啊
3. iefw4t43t43t
-
`
);
// export default class Index extends Component {