docnest 0.1.23 → 0.1.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/package.json +1 -1
- package/server/views/doc.ejs +9 -0
package/README.md
CHANGED
|
@@ -147,6 +147,7 @@ startServer(3000)
|
|
|
147
147
|
Markdown 或 HTML 中明确引用的本地附件,不按文件扩展名设置业务白名单;外链、文档链接、隐藏路径、路径穿越和代码块中的伪引用会被忽略,缺失的附件默认会让构建失败。
|
|
148
148
|
常见凭据文件(如 `.env`、私钥和证书容器)属于公共安全阻断项,即使被误写进文档链接也不会进入静态产物。
|
|
149
149
|
静态生成 HTML 时,可再调用 `rewriteDocumentAttachmentUrls`,将正文中的附件链接统一改写到 `/doc-asset/` 端点。
|
|
150
|
+
正文中的附件链接使用浏览器完整导航;独立 HTML 页面保持自己的样式和脚本,不进入 Markdown 局部刷新流程,挂载在子路径时也遵循这一规则。
|
|
150
151
|
|
|
151
152
|
## 开发
|
|
152
153
|
|
package/package.json
CHANGED
package/server/views/doc.ejs
CHANGED
|
@@ -294,6 +294,15 @@
|
|
|
294
294
|
// 检查是否是文档系统内的链接
|
|
295
295
|
const href = link.getAttribute('href');
|
|
296
296
|
if (!href) return;
|
|
297
|
+
|
|
298
|
+
// Assets, including standalone HTML pages, need full browser navigation;
|
|
299
|
+
// they do not contain the Markdown article expected by navigateToDoc.
|
|
300
|
+
try {
|
|
301
|
+
const linkUrl = new URL(href, document.baseURI || window.location.href);
|
|
302
|
+
if (/(^|\/)doc-asset\//.test(linkUrl.pathname)) return;
|
|
303
|
+
} catch (_) {
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
297
306
|
|
|
298
307
|
// 判断是否是文档系统内的链接(排除外部链接、锚点、目录页链接)
|
|
299
308
|
const isDocLink = (href.startsWith('/doc?') ||
|