diff --git a/src/app.scss b/src/app.scss index e69de29..7e6ce53 100644 --- a/src/app.scss +++ b/src/app.scss @@ -0,0 +1,3 @@ +html,body{ + user-select: auto !important; +} \ No newline at end of file diff --git a/src/pages/index/index.jsx b/src/pages/index/index.jsx index d85f4f3..a9569b2 100644 --- a/src/pages/index/index.jsx +++ b/src/pages/index/index.jsx @@ -32,12 +32,64 @@ marked.setOptions({ return val; }, }); + +// 符号 +// 🔥❓👉 +// 0️⃣1️⃣2️⃣3️⃣4️⃣5️⃣6️⃣7️⃣8️⃣9️⃣🔟 +// ©️⭐🔍〰️➖ const renderer = new marked.Renderer(); // 图片调整300px renderer.image = function (href, title, text) { console.log("href, title, text", href, title, text); - return `${text} -
🥶${text}
`; + //
${text}
+ return `${text}`; +}; + +// 有序列表 +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 input = body; + const matches = [...input.matchAll(regex)]; + const texts = matches.map((match) => match[1]); + console.log(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(''); + // return `1️⃣` + return `${string}` +}; + +// 无序列表 ▫️ +renderer.listitem = function (text, task, checked) { + // return `
  • ${text}
  • \n`; + return `▫️ ${text}
    `; +}; + +// 任务列表 +renderer.checkbox = function (checked) { + // ✅❌ + return !!checked ? "✅" : "❌"; + return ( + "' + ); +}; + +// 标题 +renderer.heading = function (text, level, raw) { + // ignore IDs + return `📋${text}
    `; + // return `${text}\n`; +}; + +// 分隔符 +renderer.hr = function () { + // return '
    \n'; + return "
    ➖➖➖➖➖
    "; }; // 引用符号 @@ -50,13 +102,27 @@ renderer.blockquote = function (quote) { var content = match[1]; // 获取第一个捕获组的内容 console.log(content); } - return `❣️${content}`; + return `👉${content}`; }; marked.use({ renderer }); +// ![测试图片2](http://hackrobot-1258475618.cos.ap-shenzhen-fsi.myqcloud.com/202304081955211.png) + const markTextStr = marked( - `![测试图片2](http://hackrobot-1258475618.cos.ap-shenzhen-fsi.myqcloud.com/202304081955211.png) - >测试` + ` + ## 标题 + >测试 + 随便测试普通的文本,要不要来个内敛的字符串 + --- + - 无序列表1 +- 无序列表2 +- [ ] 任务列表 +- [x] 完成任务 + 1. 测试111 + 2. 测试222 + 3. iefw4t43t43t + + ` ); // export default class Index extends Component { const Index = () => { diff --git a/src/pages/index/index.scss b/src/pages/index/index.scss index d00c4f9..da6031b 100644 --- a/src/pages/index/index.scss +++ b/src/pages/index/index.scss @@ -1,5 +1,10 @@ +html,body{ + user-select: auto +} .index { // font-size: 28px; +user-select:auto; +font-size: 16px; .payBtn{ // font-size: 30px;