test
This commit is contained in:
@@ -0,0 +1,3 @@
|
|||||||
|
html,body{
|
||||||
|
user-select: auto !important;
|
||||||
|
}
|
||||||
@@ -32,12 +32,64 @@ marked.setOptions({
|
|||||||
return val;
|
return val;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 符号
|
||||||
|
// 🔥❓👉
|
||||||
|
// 0️⃣1️⃣2️⃣3️⃣4️⃣5️⃣6️⃣7️⃣8️⃣9️⃣🔟
|
||||||
|
// ©️⭐🔍〰️➖
|
||||||
const renderer = new marked.Renderer();
|
const renderer = new marked.Renderer();
|
||||||
// 图片调整300px
|
// 图片调整300px
|
||||||
renderer.image = function (href, title, text) {
|
renderer.image = function (href, title, text) {
|
||||||
console.log("href, title, text", href, title, text);
|
console.log("href, title, text", href, title, text);
|
||||||
return `<img width="300px" src="${href}" alt="${text}"/>
|
// <div class="desc">${text}</div>
|
||||||
<div class="desc">🥶${text}</div>`;
|
return `<img width="300px" src="${href}" alt="${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*(.*?)<br\/?>/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) => `<div>${type==='ol'?numbers[index]:'▫️ '}${value}</div>`).join('');
|
||||||
|
// return `1️⃣`
|
||||||
|
return `${string}`
|
||||||
|
};
|
||||||
|
|
||||||
|
// 无序列表 ▫️
|
||||||
|
renderer.listitem = function (text, task, checked) {
|
||||||
|
// return `<li>${text}</li>\n`;
|
||||||
|
return `▫️ ${text}<br/>`;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 任务列表
|
||||||
|
renderer.checkbox = function (checked) {
|
||||||
|
// ✅❌
|
||||||
|
return !!checked ? "✅" : "❌";
|
||||||
|
return (
|
||||||
|
"<input " + (checked ? 'checked="" ' : "") + 'disabled="" type="checkbox">'
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 标题
|
||||||
|
renderer.heading = function (text, level, raw) {
|
||||||
|
// ignore IDs
|
||||||
|
return `📋<span>${text}</span> <br/>`;
|
||||||
|
// return `<h${level}>${text}</h${level}>\n`;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 分隔符
|
||||||
|
renderer.hr = function () {
|
||||||
|
// return '<hr>\n';
|
||||||
|
return "<br/>➖➖➖➖➖<br/>";
|
||||||
};
|
};
|
||||||
|
|
||||||
// 引用符号
|
// 引用符号
|
||||||
@@ -50,13 +102,27 @@ renderer.blockquote = function (quote) {
|
|||||||
var content = match[1]; // 获取第一个捕获组的内容
|
var content = match[1]; // 获取第一个捕获组的内容
|
||||||
console.log(content);
|
console.log(content);
|
||||||
}
|
}
|
||||||
return `❣️<span class="blockquote">${content}</span>`;
|
return `👉<span class="blockquote">${content}</span>`;
|
||||||
};
|
};
|
||||||
|
|
||||||
marked.use({ renderer });
|
marked.use({ renderer });
|
||||||
|
// 
|
||||||
|
|
||||||
const markTextStr = marked(
|
const markTextStr = marked(
|
||||||
`
|
`
|
||||||
>测试`
|
## 标题
|
||||||
|
>测试
|
||||||
|
随便测试普通的文本,要不要来个内敛的字符串
|
||||||
|
---
|
||||||
|
- 无序列表1
|
||||||
|
- 无序列表2
|
||||||
|
- [ ] 任务列表
|
||||||
|
- [x] 完成任务
|
||||||
|
1. 测试111
|
||||||
|
2. 测试222
|
||||||
|
3. iefw4t43t43t
|
||||||
|
|
||||||
|
`
|
||||||
);
|
);
|
||||||
// export default class Index extends Component {
|
// export default class Index extends Component {
|
||||||
const Index = () => {
|
const Index = () => {
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
|
html,body{
|
||||||
|
user-select: auto
|
||||||
|
}
|
||||||
.index {
|
.index {
|
||||||
// font-size: 28px;
|
// font-size: 28px;
|
||||||
|
user-select:auto;
|
||||||
|
font-size: 16px;
|
||||||
|
|
||||||
.payBtn{
|
.payBtn{
|
||||||
// font-size: 30px;
|
// font-size: 30px;
|
||||||
|
|||||||
Reference in New Issue
Block a user