From c5ff2e8e3f3e5ae5f32f0320b415aceecea8dcf2 Mon Sep 17 00:00:00 2001 From: hackrobot Date: Sat, 10 Aug 2024 11:43:38 +0800 Subject: [PATCH] update --- src/renderer/App.tsx | 70 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 66 insertions(+), 4 deletions(-) diff --git a/src/renderer/App.tsx b/src/renderer/App.tsx index 4e97765..14c443b 100644 --- a/src/renderer/App.tsx +++ b/src/renderer/App.tsx @@ -1,6 +1,6 @@ import { Component, useRef } from 'react'; import { Input } from 'antd'; -import { Button, Flex,Modal, Space } from 'antd'; +import { Button, Flex, Modal, Space } from 'antd'; // import Taro from "@tarojs/taro"; // import { // View, @@ -40,6 +40,28 @@ import TextArea from 'antd/es/input/TextArea'; // ![测试图片2](http://hackrobot-1258475618.cos.ap-shenzhen-fsi.myqcloud.com/202304081955211.png) +const createDecoratedTitleHTML = (text: any) => { + const padding = 2; // 内容左右两边的空格数 + const lineChar = '─'; // 水平线字符 + const edgeChar = '━'; // 边框装饰字符 + const cornerTopLeft = '╔'; + const cornerTopRight = '╗'; + const cornerBottomLeft = '╚'; + const cornerBottomRight = '╝'; + + // 计算标题长度 + const titleLength = text.length + padding * 2; + const lineLength = lineChar.repeat(titleLength); + const edgeLength = edgeChar.repeat(titleLength); + + // 构造 HTML + const topBorder = `${cornerTopLeft}${edgeLength}${cornerTopRight}`; + const bottomBorder = `${cornerBottomLeft}${edgeLength}${cornerBottomRight}`; + const middleLine = ` 📢 ${text}`; + + return `
${topBorder}
${middleLine}
${bottomBorder}

\n`; +}; + marked.setOptions({ breaks: true, // 是否回车换行 gfm: true, //使用经批准的 GitHub Flavored Markdown (GFM) 规范 @@ -138,7 +160,27 @@ renderer.heading = function (text, level, raw) { // ignore IDs // return `📋${text}
`; // return `🔥${text}
`; - return `
🔥${text}
\n`; + if (level == 1) { + return createDecoratedTitleHTML(text); + } else if (level == 2) { + return `
🔥${text}
\n`; + } else { + return `
🔥${text}
\n`; + } + + return `
╔═━──────━═╗
+ 🔥 ${text}
+╚═━──────━═╝ +
\n`; + + // return `
* * * * * * * * * * *
+ // * ${text} *
+ // * * * * * * * * * * * + //
\n`; + + // return `
==================
+ // || 📢 ${text} 📢 ||
+ // ==================
\n`; // return `🔥${text}\n`; // return `🔥${text}
`; @@ -181,7 +223,9 @@ renderer.blockquote = function (quote) { //

   //  
   // return `\t 👉${content}
` - return `
\t 👉${content}
\n`; + // return `
\t 📌${content}
\n`; //ok + // ├─ + return `
            └─📌${content}
`; }; renderer.table = function (header, body) { @@ -271,9 +315,27 @@ const Index = () => { console.log('onInputtxt--->', onInputtxt?.target?.value); setinputValue(onInputtxt.target.value); // console.log('inputValue',inputValue) + // let value = onInputtxt?.target?.value; let value = onInputtxt?.target?.value; + if (value) { - setmarkText(value); + // +`🅥🟢🆔:hackrobot` + // +`➕🅥=>🟩🆔: hackrobot,可以找我聊天💬 ` +// let contactMe=`
➖➖➖➖➖
在🟩【wΞ𝗫𝗜𝗡】➡️联系我 【➕🅥】: +// ╭────────────────╮ +// │ 🆔 hackrobot +// ╰────────────────╯ +// 💬 随时欢迎聊天 +// ` + +let contactMe=`╭────────────────────╮ +│ 🟩【wΞ𝗫𝗜𝗡】➡️联系我【➕🅥】 +│ +│ 🆔 hackrobot +│ +│ 💬 随时欢迎聊天 +╰────────────────────╯` + setmarkText(value+contactMe); } };