This commit is contained in:
hackrobot
2024-08-10 11:43:38 +08:00
parent ff27af074a
commit c5ff2e8e3f

View File

@@ -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 `<div>${topBorder}<br/>${middleLine}<br/>${bottomBorder}</div><br/>\n`;
};
marked.setOptions({
breaks: true, // 是否回车换行
gfm: true, //使用经批准的 GitHub Flavored Markdown (GFM) 规范
@@ -138,7 +160,27 @@ renderer.heading = function (text, level, raw) {
// ignore IDs
// return `📋<span>${text}</span> <br/>`;
// return `🔥<span>${text}</span> <br/>`;
return `<div>🔥${text}</div>\n`;
if (level == 1) {
return createDecoratedTitleHTML(text);
} else if (level == 2) {
return `<div>🔥${text}</div>\n`;
} else {
return `<div>🔥${text}</div>\n`;
}
return `<div>╔═━──────━═╗<br/>
🔥 ${text}<br/>
╚═━──────━═╝
</div>\n`;
// return `<div>* * * * * * * * * * *<br/>
// * ${text} *<br/>
// * * * * * * * * * * *
// </div>\n`;
// return `<div>==================<br/>
// || 📢 ${text} 📢 ||<br/>
// ==================</div>\n`;
// return `<h${level}>🔥<span>${text}</span></h${level}>\n`;
// return `<h${level}>🔥${text}</h${level}><br/>`;
@@ -181,7 +223,9 @@ renderer.blockquote = function (quote) {
// <pre></pre>
// &nbsp;
// return `<span style="white-space:pre;" class="blockquote">\t 👉${content}</span><br/> `
return `<div style="white-space:pre;" class="blockquote">\t 👉${content}</div>\n`;
// return `<div style="white-space:pre;" class="blockquote">\t 📌${content}</div>\n`; //ok
// ├─
return `<div style="white-space:pre;" class="blockquote">&#8239;&#8239;&#8239;&#8239;&#8239;&#8239;&#8239;&#8239;&#8239;&#8239;&#8239;&#8239;└─📌${content}</div>`;
};
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=`<br><br/>在🟩【wΞ𝗫𝗜𝗡】➡联系我 【➕🅥】:
// ╭────────────────╮
// │ 🆔 hackrobot
// ╰────────────────╯
// 💬 随时欢迎聊天
// `
let contactMe=`╭────────────────────╮
│ 🟩【wΞ𝗫𝗜𝗡】➡联系我【🅥】
│ 🆔 hackrobot
│ 💬 随时欢迎聊天
╰────────────────────╯`
setmarkText(value+contactMe);
}
};