Repository navigation
Conversation
… 1.8.7 typings - markdown-it v14 moved type declarations to .mjs files, update deep imports - Events.on callback data is now unknown in obsidian 1.8.7, cast to WordPressOAuth2Token
Obsidian syntax which is now converted while publishing: - wikilinks [[note]], [[note|alias]], [[note#heading]] become permalinks when the target note has been published with the same profile (permalink stored as postLink frontmatter), plain text otherwise - note embeds ![[note]] and ![[note#heading]] are expanded recursively (up to 5 levels, cycles detected) instead of being uploaded as binary - callouts > [!type] become styled <div>/<details> elements - task lists - [ ]/- [x] become HTML checkboxes - highlights ==text== become <mark> - footnotes [^1] via markdown-it-footnote - mermaid fences become <pre class="mermaid"> - multi-line %% comment blocks - frontmatter: excerpt/slug/date support, tags as string or list Media handling fixes: - resolve media against the source note path so relative links work - do not crash on '%' in media paths - upload each file only once per publish and remember uploads between publishes (clearable cache), fixing repeated uploads on re-publish - correct replacement preserving size/alt text, non-image files linked - note write-back (replaceMediaLinks) never writes expanded embed content back into the note and no longer targets the active editor Other fixes: - publishing no longer creates an empty frontmatter block or eats content when a note starts with a horizontal rule - choosing 'use old profile' now republishes with the old profile instead of using a foreign postId against the current site - XML-RPC: CDATA sections are split on ']]>' so content containing it does not corrupt the request - default API type for new profiles is application passwords - do not log credentials, tokens or full request/response bodies
… test connection button - the WordPress URL field now accepts bare hosts like 1.2.3.4:8080 and completes them with the http:// scheme - username/password inputs are always visible in the profile modal; the remember toggles only control persistence instead of hiding the fields - a test connection button validates the address and credentials without saving the profile
Embeds like ![[note]] mentioned inside inline code or fenced code blocks (e.g. when documenting Obsidian syntax in a note) were treated as real embeds by the raw-text pipeline: they got expanded, triggered false cycle warnings, and their media got parsed for upload. Compute protected code ranges and skip matches inside them, for both expandNoteEmbeds and getMediaRefs. Also add test/preview.ts which renders a real vault note with the plugin's exact pipeline into an expected-result HTML file.
…styles - mermaid fences are rendered to standalone inline SVG at publish time (mermaid bundled, loaded lazily). Diagrams survive any WordPress theme with no site-side mermaid plugin; failed renders fall back to <pre class="mermaid"> with a warning notice - code fences are highlighted at publish time with highlight.js (core + 23 common languages), so published code is highlighted without any client-side plugin - posts using callouts, task lists, highlights, footnotes or highlighted code get a small stylesheet embedded into the content, making them render correctly with any WordPress theme - esbuild production builds are minified now (8023065 vs 16.4MB bytes with mermaid added)
…e; harden mermaid rendering - when publishing a note whose wikilinks point to unpublished notes, those notes are published first with the default options (recursive, cycle-safe, already published notes skipped), so the links resolve to their permalinks; toggleable in settings - XML-RPC: frontmatter dates are sent as post_date (site timezone) instead of post_date_gmt, which shifted the published date by the site UTC offset and accidentally scheduled posts - mermaid: 15s per-diagram timeout with fallback to the original fence, pure SVG labels (htmlLabels: false) for better portability, and a publish pipeline stats notice so users can confirm rendering ran
…e freshly auto-published links - WordPress's wpautop filter inserts <p>/<br /> at line breaks of the post content, which tore multi-line mermaid SVGs apart on the frontend: an empty diagram box with stray label text. The rendered SVG is now flattened to a single line before embedding. - links to notes that were auto-published during the same run now resolve to their permalinks via an in-memory map, instead of incorrectly reporting them as unresolved (the metadata cache has not re-indexed the freshly written frontmatter yet)
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Obsidian 笔记发布到 WordPress 后,Mermaid 图可能丢失框线和箭头、文字错位,双向链接、嵌入笔记及本地媒体也无法完整保留原来的效果。本 PR 完善发布时的语法转换和媒体处理,支持批量选择笔记或文件夹发布,并补充发布流程的回归测试。
主要改动
批量发布:新增命令面板、文件列表多选右键及文件夹右键入口,也可在批量窗口中搜索、勾选笔记或选择文件夹(包括子目录)。右键入口会保存先前选择并自动勾选,右键文件夹时自动带入文件夹;已选笔记优先显示,避免被全库前 200 项的显示上限隐藏,同一菜单不会出现重复入口。发布前只读扫描并列出选中笔记、将一同全文发布的引用/嵌入文章、附件、跨账户新建文章和缺失引用,确认后才执行。递归处理 wiki 与普通/引用式 Markdown 链接,使用已确认内容快照,按依赖顺序发布;循环引用复用原文章 ID 补全链接,共享附件只上传一次并保留 PDF 页码等片段。可停止后续任务,关闭窗口或卸载插件也会停止;完成后汇总成功、失败和未执行项。批量流程独立于单篇自动发布开关,无逐篇确认框。
插件重新启用:修复内置 MathJax 读取 Obsidian 全局 loader 导致
MathJax.loader.preLoad is not a function、插件无法开启的问题。直接注册原有 TeX 扩展,不调用或修改宿主 loader。新增实际生产构建的加载/卸载/再次加载回归测试,并接入检查和发布工作流。Mermaid 与代码高亮:发布时将 Mermaid 渲染为 SVG,用保护容器避免 WordPress 的
wpautop拆坏图形;修正 Mermaid 12 的全局文字标签配置。每次发布独立保存 SVG,失败或超时保留原代码并清理临时 DOM。代码块用 highlight.js 高亮,样式随文章内嵌。Obsidian 语法:支持双向链接、标题/块锚点、递归嵌入、callout、任务列表、高亮、脚注及多行注释。已发布笔记的链接转换为永久链接;嵌入笔记按自身目录解析图片和链接。缺失章节、循环或超深嵌入显示占位和提示,不回退到全文,也不上传原始 Markdown 笔记。
关联笔记发布:增加可选的递归自动发布,默认关闭。只处理正文中的有效双向链接,忽略注释、转义文本和代码;用户提交主文章的发布对话框后才执行,取消对话框不会发布关联笔记。
媒体处理:修正相对路径、文件名编码、图片大小/替代文字及附件 MIME 类型;同一文件在一次发布中只上传一次,跨发布缓存按站点和账户隔离。按扫描位置替换引用,避免误改相同文本的代码示例;可选写回通过原文件的原子处理完成,保留嵌入语法和同时发生的编辑。
账户与发布参数:支持裸主机/端口地址和连接测试;凭据的记住开关控制磁盘持久化,移除凭据/响应日志。修正切换回原 profile 时的文件选择,补充
excerpt、slug、date、标签规范化及发布后永久链接记录,并处理 XML-RPC 文本中的]]>。构建与文档:修正 markdown-it v14 类型路径,统一版本信息为 0.24.2,更新发布工作流至 Node.js 22,增加 PR 测试/构建检查及真实浏览器测试入口,补全文档。
验证
0.24.2:91 项源码测试、TypeScript 检查及生产构建通过。生产 main.js 在无全局 MathJax、loader 缺少 preLoad、loader 禁止调用三种状态下均通过两次加载/卸载;普通公式、化学式、矩阵的 SVG 渲染通过。用户已确认实际 Obsidian 1.14.4 中重新启用正常。
0.24.2 lint 限制:现有 ESLint 9.20.0 与 eslint-plugin-node 11.1.0 的规则接口不兼容(context.getScope),未升级工具链,未声称 lint 通过。
Windows(0.24.1):
npm test,90 项测试通过;TypeScript 检查及生产构建通过。Linux(0.24.0):89 项测试、TypeScript 检查及生产构建通过。Linux 依赖按锁文件通过
npm ci安装;npm run test:browser:build通过。Edge 实际渲染中文 Mermaid 图,框线、箭头和标签正常;重复渲染、语法错误回退、模拟挂起后的超时回退和临时 DOM 清理均通过。
Edge 右键入口(0.24.1,实际插件菜单处理和批量窗口、SDK 适配层):214 篇笔记的模拟库中,多选的 2 篇自动勾选并排在顶部;单篇/多篇菜单事件只生成一个入口,菜单关闭清空原选择数组后仍保留多选;文件夹及子目录笔记自动勾选,返回选择页后状态保留,无页面异常、无远端请求。
Edge 批量界面:选择文件夹 2 篇笔记,预览额外引用 1 篇文章及 1 个共享附件,确认后模拟发布 3 篇草稿、附件只上传 1 次;确认前/取消后无上传请求,停止或关闭进行中的窗口只完成当前文章,无页面异常。
自建 WordPress 的 XML-RPC 发布及实际前台已验证 SVG 保护容器能完整保留图形。REST、多账户及并发场景由模拟接口测试覆盖;新增批量功能的浏览器验证使用 SDK 适配层和模拟远端,尚未做真实 WordPress 批量端到端验证,远端成功后本地写回失败的恢复也未验证。
独立只读审查发现的问题已修复并复核:批量窗口关闭/插件卸载的停止路径、嵌入笔记中嵌套图片链接的路径重写、附件链接片段保留。