正文
增加 46 行删除 5 行
7 行未改动891011121314152 行未改动18192021222324252627282930313233343536373824 行未改动6364656667686970717237 行未改动1101111121131141151161171187 行未改动修复了除 `#`、`>`、折叠框、表格等以外常见的 Markdown 格式,比如~~删除线~~、**加粗**以及链接、图床等。出现问题欢迎反馈。::::info[$upd$]- $1.2.8$ 版($2026.5.9$):首个发布版,~~DeepSeeK 还是太好用了你们知道吗~~。- $2.1.1$ 版($2026.5.9$):于当日下午发现恶性 bug,感谢同学@[Sakument_tree](https://www.luogu.com.cn/user/786914) 的帮助,修复了 bug,同时优化了正则逻辑,修复了 `@` 符后的链接渲染问题。2 行未改动- 在回复中包含链接时,不再使用 `[]()` 语法;- 优化了回复格式,使其不再丢失原有回复格式中的空格;- 优化了“回复”按钮的匹配逻辑;- 现在图床 `![]()` 格式可以正常包含链接了。::::::::info[代码($3.1.1$ 版)]```javascript// ==UserScript==// @name benben-better// @namespace http://tampermonkey.net/// @version 3.1.1// @description 解决犇犇回复时丢失 LaTeX 和 Markdown 格式的问题// @author a_small_OIer// @match www.luogu.com.cn// @grant none// ==/UserScript==(function(){'use strict';const REPLY_TEXT_MATCH = /回复|reply/i;function generateMarkdown(node) {24 行未改动const isMention = text.trim().startsWith('@') || /\/user\//.test(href);const isBareURL = /^(https?:\/\/|www\.)/i.test(text.trim()) && !/\s/.test(text.trim());if (isMention || isBareURL) {result += text;} else {result += '[' + text + '](' + href + ')';}} else if (tag === 'strong' || tag === 'b') {result += '**' + n.textContent + '**';} else if (tag === 'em' || tag === 'i') {37 行未改动}setTimeout(fillSource, 200);});})();```::::::::info[一句闲话]这个脚本同时支持修复 [$\LaTeX$](https://www.luogu.com.cn/article/x9dpta33) 文本。::::7 行未改动8910111213141516172 行未改动2021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707124 行未改动9697989910010110210310410510610710810911011111237 行未改动1501511521531541551561571581597 行未改动修复了除 `#`、`>`、折叠框、表格等以外常见的 Markdown 格式,比如~~删除线~~、**加粗**以及链接、图床等。出现问题欢迎反馈。**现在你可以在 [github](https://github.com/a-small-OIer/benben-better/) 上发现这个项目了**。::::info[$upd$]- $1.2.8$ 版($2026.5.9$):首个发布版,~~DeepSeeK 还是太好用了你们知道吗~~。- $2.1.1$ 版($2026.5.9$):于当日下午发现恶性 bug,感谢同学@[Sakument_tree](https://www.luogu.com.cn/user/786914) 的帮助,修复了 bug,同时优化了正则逻辑,修复了 `@` 符后的链接渲染问题。2 行未改动- 在回复中包含链接时,不再使用 `[]()` 语法;- 优化了回复格式,使其不再丢失原有回复格式中的空格;- 优化了“回复”按钮的匹配逻辑;- $3.1.2$ 版($2026.5.14$)感谢@[limaotong](https://www.luogu.com.cn/user/1417265) 反馈的 bug,现在可以正常使用 `[![]()]()` 语法了;同时感谢@[_zyx2012](https://www.luogu.com.cn/user/1934210) 的提醒,补充了 MIT 开源协议声明。现在你可以在 [github](https://github.com/a-small-OIer/benben-better/) 上下载脚本了。::::::::info[代码($3.1.2$ 版)]```javascript// ==UserScript==// @name benben-better// @namespace http://tampermonkey.net/// @version 3.1.2// @description 解决犇犇回复时丢失 LaTeX 和 Markdown 格式的问题// @author a_small_OIer// @match www.luogu.com.cn// @grant none// @license MIT// ==/UserScript==/** MIT License** Copyright (c) 2026 a_small_OIer** Permission is hereby granted, free of charge, to any person obtaining a copy* of this software and associated documentation files (the "Software"), to deal* in the Software without restriction, including without limitation the rights* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell* copies of the Software, and to permit persons to whom the Software is* furnished to do so, subject to the following conditions:** The above copyright notice and this permission notice shall be included in all* copies or substantial portions of the Software.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE* SOFTWARE.*/(function(){'use strict';const REPLY_TEXT_MATCH = /回复|reply/i;function generateMarkdown(node) {24 行未改动const isMention = text.trim().startsWith('@') || /\/user\//.test(href);const isBareURL = /^(https?:\/\/|www\.)/i.test(text.trim()) && !/\s/.test(text.trim());if (isMention || isBareURL) {result += text;}else{let inner = '';for (let i = 0; i < n.childNodes.length; i++) {inner += generateMarkdown(n.childNodes[i], false);}if (inner === '') {inner = text;}result += '[' + inner + '](' + href + ')';}} else if (tag === 'strong' || tag === 'b') {result += '**' + n.textContent + '**';} else if (tag === 'em' || tag === 'i') {37 行未改动}setTimeout(fillSource, 200);});})();```::::::::info[一句闲话]这个脚本同时支持修复 [$\LaTeX$](https://www.luogu.com.cn/article/x9dpta33) 文本。::::