swiSwift543 downloadsHighlight text with regex + custom CSS. Add interlinear notes, remarks with backlinks, AI relation graphs, AskMe, & floating notes (in-app or standalone).
义父/Patron daddy:莫问归期6666
Highlight text with regex and custom CSS. Add interlinear notes above keywords, keyword-level remarks with backlinks, and AskMe AI questions to deepen understanding. (Formerly Regex CSS Highlighter)/通过正则表达式匹配文本并应用自定义CSS高亮。支持在关键词上方添加行间注释、关键词级别的带反链批注,以及AskMe AI提问以加深理解。(原 Regex CSS Highlighter)




Search for "Regex Css Highlighter" in Obsidian Settings → Community Plugins → Browse to install directly. 在 Obsidian 设置 → 社区插件 → 浏览 中搜索 "Regex Css Highlighter" 直接安装。
main.js and manifest.json / 下载 main.js、manifest.jsonRegex-Css-Highlighter folder in your Obsidian vault's .obsidian/plugins/ directory / 在 Obsidian 库的 .obsidian/plugins/ 目录下创建 Regex-Css-Highlighter 文件夹_syncNoteTheme; panel color changes now sync to inline notes / 修复配色方案切换时内嵌笔记颜色不同步意识(?!到|不) no longer incorrectly matches "意识到"/"意识不" / lookahead规则不再错误匹配排除文本bc|d now correctly show chips when selected / 正则词选中后正确显示chip.蓝眼泪 now correctly show "Update" button / 中文类名按钮正确显示"更新"selectionchange from removing buttons immediately after click / 防止selectionchange在点击后立即移除按钮onunload missing defaultFnGroup causing corruption / JSON解析失败自动截断修复;修复onunload缺少defaultFnGroup导致损坏renderRemarkContent so all remark elements respond to double-click editing / 在renderRemarkContent中添加事件委托,所有备注元素均可双击编辑position:fixed on document.body to prevent changing card position which caused window to disappear / tooltip改为fixed定位挂载body,避免误改卡片position导致窗口消失card._schemeTip prevents duplicates on continuous scroll; card.remove() auto-cleans / tip存储在card属性避免重复创建;关闭时自动清理customColorSchemes from global-notes.json to color-schemes.json; old {bg,text} format converted to CSS rules / 自定义配色从global-notes.json迁移到color-schemes.json;旧格式转为CSS规则colorSchemePresets; removed hardcoded theme arrays; all themes derived via schemeToTheme / 新建笔记循环配色预设;移除硬编码主题;统一用schemeToTheme推导inputValue undefined, insertBefore error, middle-click closing panel / 修复未定义变量、insertBefore错误、中键关闭面板.scheme-id { background:...; color:...; }); id from class name; no class = invalid / 配色方案数据重构为标准CSS规则;id从类名提取;无类名无效cat field and grouped rendering; flat 5-column grid / 移除cat字段和分组渲染;平铺5列网格.sg-float-vintage-01 → .vintage-01 for cleaner editing / 类名修剪,更易编辑<pre>; real-time preview on edit; clicking swatch shows CSS / 共用textarea替代只读pre;编辑实时预览;点击色卡显示CSS{bg,text} formats / 兼容CSS和旧{bg,text}格式defaultFnGroup / 右键分组chip设为默认;通过defaultFnGroup持久化.bak.json before write, auto-restore from backup when main file empty / 卸载时同步保存,快照防竞态覆盖,写入前备份,主文件为空自动恢复flex-basis:100%; only visible when style chip active / 移入chipBar内部,仅在style chip激活时显示scheduleHide() / 排除chipBar内部事件防止误触收起mouseleave checks relatedTarget to avoid hiding when mouse stays in chipBar / 检查relatedTarget防止chipBar内移动时收起currentEditingRule prioritizes exact match over first-in-array, then longest match / 优先精确匹配,其次最长匹配currentEditingRule and highlightMatchingRuleButtons are updated in all branches, fixing file rule group not appearing / 样式点击后更新状态,修复全局规则点击其他样式后文件规则分组不显示mouseover/mouseout + closest(selector), fixing collapsed groups after DOM rebuild / 改用事件委托,修复DOM重建后展开分组收起_splitRegexPipes() with bracket-depth awareness; replaced 31 occurrences of regex.split('|') to correctly handle | inside lookbehind/lookahead/groups (e.g., (?<!拉|欧)美国|United States) / 新增_splitRegexPipes()括号深度感知分割函数,替换31处regex.split('|'),修复lookbehind等括号内含|时被错误拆分的问题_inSidebar to dynamic isInSidebar() check / 修复面板移入侧边栏后标题栏仍显示抓手指针且可拖动的问题,将静态_inSidebar改为动态isInSidebar()检测saveGlobalNotes() to prevent file corruption from overlapping async writes / 为saveGlobalNotes添加写入锁,防止并发异步写入导致文件损坏@electron/remote require order and render timing / 启动时独立窗口正确恢复,修复@electron/remote获取顺序和渲染时序textContent to innerText in popout blur handler to preserve line breaks / 用innerText替代textContent保留换行符innerHTML += destroying event listeners when no remarks exist / 相关笔记和高亮链接在手机端现在可正常点击,修复无备注时事件监听器被销毁的问题(?<!发展)中国); auto-extracts plain text fallback when full regex matching fails / 相关笔记和高亮现在支持正则模式关键词,正则匹配失败时自动提取纯文本回退匹配(?<!发展)中国); auto-extracts plain text fallback when full regex matching fails / 相关笔记和高亮现在支持正则模式关键词,正则匹配失败时自动提取纯文本回退匹配rulesUpdateEmitter; clicking l/g button or adding rules via floating ball instantly updates the panel / 右侧面板监听规则更新事件,点击l/g按钮或悬浮球添加规则后面板即时刷新ruleSource (matching n-button pattern); fixed first-time remark addition failing for local rules in sidebar / 重写"+"按钮保存逻辑,修复侧边栏局部规则首次添加备注失败display:none to hide status bar / 设置弹窗改用display:none隐藏状态栏[SG-DEBUG] console.log statements / 移除全部14条调试日志relatedTarget detection with mousemove bounds-box; added popup.contains check for fixed badges / 将不可靠的relatedTarget改为mousemove包围盒检测,增加popup.contains覆盖fixed定位badgebringToFront with _topZ counter; all popups raise z-index on mousedown, fixing chip preview behind windows / 新增bringToFront动态提升z-index,修复chip预览显示在窗口下方applyZoom sets SVG dimensions directly; tryFit waits for actual content with requestAnimationFrame; viewport height synced / 直接设SVG宽高,等待实际图形元素渲染,viewport高度同步className (SVGAnimatedString) / 修复SVG元素className类型错误崩溃[RemarkPopup] console logs / 移除所有调试日志onReposition callback to recalculate popup position after graph is fully rendered / 修复备注弹窗打开时AI关系图显示不全的问题;新增MutationObserver监听SVG出现后重新应用缩放,并添加onReposition回调在图形渲染完成后重新计算弹窗位置| to match each alternative separately / 渲染时按|分割正则key分别匹配,支持多分支正则模式_sanitizeMermaid line parser with cross-line node tracking and bracket definition helpers; correctly handles chained edges and bracket node definitions / 重写行解析器,新增跨行节点追踪和辅助函数,正确处理链式边和带括号定义的节点filePath as falsy, now uses !== undefined check / 修复编辑AI问题备注后退出再双击编辑时内容消失:预保存条件将空filePath当作falsy跳过,改为!== undefined检查backdrop-filter:blur(16px) saturate(180%) + semi-transparent background / 所有弹窗统一使用毛玻璃效果,替换原有实心背景renderRemarkContent shared function, both popups share content rendering, reducing ~774 lines of duplicate code / 提取 renderRemarkContent 共享函数,两个弹窗共享内容渲染逻辑,减少约774行重复代码fileRules Map iteration with _fileRulesData traversal, ensuring all links.filePath are correctly updated / 修复文件改名后备注弹窗中引用的文件路径未更新的bug:将 links 更新逻辑移出条件守卫,改用 _fileRulesData 遍历替代 fileRules Map 遍历,确保无论被重命名文件是否有自身规则、其他文件规则是否已加载,所有 links.filePath 都能正确更新/ from file rule keys on startup, fixing root-level file rules not loading — one-time migration / 启动时自动检测并移除库根文件夹下文件规则 key 的前缀 /,修复根目录文件规则无法加载的问题,一次性迁移rule.remark to link entries (filePath: "") on startup, clears the old field and persists changes / 启动时自动将旧版 rule.remark 迁移为 link 条目(filePath: ""),迁移后清空旧字段并持久化injectInterlinearNoteStyles always using default CSS instead of user-customized CSS, causing interlinear note styles to revert to defaults after restart / 修复 injectInterlinearNoteStyles 始终使用默认CSS而非用户自定义CSS,导致重启后行间注释字体大小等样式恢复默认的bughas-counter class added at creation time to avoid timing issues / 当关键词同时有行间注释和计数时,行间注释自动移至关键词下方、计数保持在上方,创建时即添加 has-counter 类避免时序问题_count.json count file generation and related code (updateStyleCountFile, loadStyleCountFile, loadAngle0Styles, 16 call sites, 6 i18n entries) / 完全移除 _count.json 计数文件生成机制及相关代码,包括 updateStyleCountFile、loadStyleCountFile、loadAngle0Styles 等函数,以及所有 16 处调用点和 6 条 i18n 条目getUnusedStyles now computes unused styles from in-memory fileRules and globalRules instead of count files / getUnusedStyles 不再依赖 count 文件,改为从内存中的 fileRules 和 globalRules 实时统计未使用样式data/{encoded_name}.json into single data/file-rules.json using original file paths as keys / 所有文件高亮规则从 data/{编码文件名}.json 合并到 data/file-rules.json,key 使用原始文件路径,消除路径编码歧义saveFileRules writes to in-memory cache first, flushes to disk with 500ms debounce; loadFileRules reads from memory with zero IO / saveFileRules 先写入内存缓存,500ms debounce 后批量写磁盘,loadFileRules 从内存读取零IOfile-rules.json on first launch, cleans up _count.json files, sets flag to avoid re-running / 首次启动时自动将零散规则文件迁移到 file-rules.json,同时清理所有 _count.json 文件,迁移完成后设置标志位不再重复执行showErrorMessage单参数调用导致styleOption.appendChild抛出TypeError的问题updateCurrentRule检查返回值避免误报成功2px solid var(--interactive-accent) for both rule and style buttons; removed scale/glow effects / 规则按钮和样式按钮的匹配高亮统一为主题色粗边框,移除scale/发光效果data-class attribute, which was the root cause of style chips not auto-activating and style buttons not being highlighted / 修复样式按钮未设置data-class属性导致样式chip不自动激活、样式按钮不高亮的根本问题this.plugin.deleteRuleById应为this.deleteRuleById导致的TypeError_aiThread / 每个AI问题支持多轮对话:点"?"请AI拆解问题,点"↗"将回答反馈给AI;对话线程持久化存储clearHighlights preserves in-note-wrapper structure; notes with styles display correctly without scrolling / 阅读模式先应用行间注释再应用样式高亮;clearHighlights保护in-note-wrapper结构不被破坏;有行间注释的关键词样式正常显示,无需滚动color:transparent+background-clip:text now extract gradient color for chip text / 使用渐变文字样式的关键词现在从渐变色提取chip文字颜色::before/CM6 Decoration display; independent storage; 6 presets + alignment + custom CSS / 新功能:选中文本→浮动输入框→伪元素/CM6显示;独立存储;6种预设+对齐方式+自定义CSS| now correctly matched in chips backlinks via plainTexts array / 含|的规则现在通过plainTexts数组正确匹配chips反向链接in-note-wrapper replaces per-character spans; !important reset; inherits gradient styles; alignment setting / in-note-wrapper替代逐字span;!important重置;继承渐变样式;对齐方式设置prompt() with a custom frosted-glass input dialog for group naming / 用自定义毛玻璃输入弹窗替代 Electron 不支持的 prompt(),用于分组命名require('fs')/require('path') at module level to eliminate repeated require calls; cached styles.css content to reduce 5 disk reads to 1; batched all saveData() calls in onload() from 10+ async writes to at most 1; parallelized independent async operations (loadStyleCategories, loadGlobalRules, _preloadPinyinData) with Promise.all; eliminated duplicate style-categories.json reads in syncStylesToCategories; deferred cacheHoverStyles() to lazy-load on first use instead of blocking startup; fixed _preloadPinyinData() being called twice / 将 require('fs')/require('path') 缓存至模块级别,消除重复 require 调用;缓存 styles.css 内容,将5次磁盘读取减少为1次;将 onload() 中的 saveData() 调用从10+次异步写入合并为最多1次;使用 Promise.all 并行化独立异步操作(loadStyleCategories、loadGlobalRules、_preloadPinyinData);消除 syncStylesToCategories 中 style-categories.json 的重复读取;将 cacheHoverStyles() 延迟到首次使用时懒加载,不再阻塞启动;修复 _preloadPinyinData() 被重复调用的问题handleFileRenameOrMove now updates links[].filePath in all rules (current file, global, and other files) and persists changes to disk / 修复重命名笔记后备注弹窗中文件名不更新的问题;handleFileRenameOrMove 现在会更新所有规则(当前文件、全局、其他文件)中的 links[].filePath 并持久化到磁盘#555 color from "Single Display" and "Always Display" section titles, now uses default theme text color for proper visibility in dark mode / 移除"单显"和"常显"标题的 #555 硬编码颜色,现在使用默认主题文字颜色,深色模式下可正常显示<button> to <h4> element, fixing custom styles (gradient backgrounds, custom colors) not applying correctly / 单显标签从 <button> 改为 <h4> 元素,修复自定义样式(渐变背景、自定义颜色)无法正确应用的问题\\.) could not be matched when removing highlights by selecting text; replaced direct string comparison with regex matching via textMatchesRegex() helper function / 修复含正则转义字符(如 \\.)的规则无法通过选中文本移除高亮的问题,改用 textMatchesRegex() 辅助函数进行正则匹配applyHighlightsToLivePreviewCallouts method to apply DOM-based highlighting to callout widgets in live preview mode; ViewPlugin's update now schedules callout highlight via debounced requestAnimationFrame; scroll and layout-change events also trigger callout highlighting in source mode / 添加 applyHighlightsToLivePreviewCallouts 方法,对实时预览中的callout组件应用DOM高亮;ViewPlugin更新时通过防抖 requestAnimationFrame 调度callout高亮;滚动和布局变化事件也会触发callout高亮to key; added validation filter for invalid ranges; switched to Decoration.set(validRanges, true) to enable CodeMirror's internal sorting for safer handling of overlapping decorations from multiple rules / 改进范围排序,增加 to 作为次要排序键;添加无效范围过滤;使用 Decoration.set(validRanges, true) 启用CodeMirror内部排序,更安全地处理多规则重叠装饰addremark.gif to assets folder and referenced it in both English and Chinese Notes/备注功能 sections of README.md / 在assets文件夹添加 addremark.gif,并在README中英文备注功能部分引用If you find this plugin helpful, consider buying me a coffee! / 如果这个插件对你有帮助,请考虑支持我!