Merge branch 'main' into react/collections

This commit is contained in:
Elian Doran 2025-09-14 19:01:18 +03:00 committed by GitHub
commit ec5e7607f0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 585 additions and 449 deletions

View File

@ -102,7 +102,12 @@ jobs:
exit $EXIT_CODE exit $EXIT_CODE
fi fi
} }
- name: Fix HTML Links
run: |
# Remove .md extensions from links in generated HTML
pnpm tsx ./scripts/fix-html-links.ts site
- name: Validate Built Site - name: Validate Built Site
run: | run: |
# Basic validation that important files exist # Basic validation that important files exist

View File

@ -67,7 +67,7 @@
"@types/xml2js": "0.4.14", "@types/xml2js": "0.4.14",
"archiver": "7.0.1", "archiver": "7.0.1",
"async-mutex": "0.5.0", "async-mutex": "0.5.0",
"axios": "1.11.0", "axios": "1.12.0",
"bindings": "1.5.0", "bindings": "1.5.0",
"bootstrap": "5.3.8", "bootstrap": "5.3.8",
"chardet": "2.1.0", "chardet": "2.1.0",

View File

@ -1,428 +1,432 @@
{ {
"keyboard_actions": { "keyboard_actions": {
"open-jump-to-note-dialog": "打开“跳转到笔记”对话框", "open-jump-to-note-dialog": "打开“跳转到笔记”对话框",
"search-in-subtree": "在当前笔记的子树中搜索笔记", "search-in-subtree": "在当前笔记的子树中搜索笔记",
"expand-subtree": "展开当前笔记的子树", "expand-subtree": "展开当前笔记的子树",
"collapse-tree": "折叠完整的笔记树", "collapse-tree": "折叠完整的笔记树",
"collapse-subtree": "折叠当前笔记的子树", "collapse-subtree": "折叠当前笔记的子树",
"sort-child-notes": "排序子笔记", "sort-child-notes": "排序子笔记",
"creating-and-moving-notes": "创建和移动笔记", "creating-and-moving-notes": "创建和移动笔记",
"create-note-into-inbox": "在收件箱(若已定义)或日记中创建笔记", "create-note-into-inbox": "在收件箱(若已定义)或日记中创建笔记",
"delete-note": "删除笔记", "delete-note": "删除笔记",
"move-note-up": "向上移动笔记", "move-note-up": "向上移动笔记",
"move-note-down": "向下移动笔记", "move-note-down": "向下移动笔记",
"move-note-up-in-hierarchy": "在层级中向上移动笔记", "move-note-up-in-hierarchy": "在层级中向上移动笔记",
"move-note-down-in-hierarchy": "在层级中向下移动笔记", "move-note-down-in-hierarchy": "在层级中向下移动笔记",
"edit-note-title": "从树跳转到笔记详情并编辑标题", "edit-note-title": "从树跳转到笔记详情并编辑标题",
"edit-branch-prefix": "显示编辑分支前缀对话框", "edit-branch-prefix": "显示编辑分支前缀对话框",
"note-clipboard": "笔记剪贴板", "note-clipboard": "笔记剪贴板",
"copy-notes-to-clipboard": "复制选定的笔记到剪贴板", "copy-notes-to-clipboard": "复制选定的笔记到剪贴板",
"paste-notes-from-clipboard": "从剪贴板粘贴笔记到当前笔记中", "paste-notes-from-clipboard": "从剪贴板粘贴笔记到当前笔记中",
"cut-notes-to-clipboard": "剪切选定的笔记到剪贴板", "cut-notes-to-clipboard": "剪切选定的笔记到剪贴板",
"select-all-notes-in-parent": "选择当前笔记级别的所有笔记", "select-all-notes-in-parent": "选择当前笔记级别的所有笔记",
"add-note-above-to-the-selection": "将上方笔记添加到选择中", "add-note-above-to-the-selection": "将上方笔记添加到选择中",
"add-note-below-to-selection": "将下方笔记添加到选择中", "add-note-below-to-selection": "将下方笔记添加到选择中",
"duplicate-subtree": "复制子树", "duplicate-subtree": "复制子树",
"tabs-and-windows": "标签页和窗口", "tabs-and-windows": "标签页和窗口",
"open-new-tab": "打开新标签页", "open-new-tab": "打开新标签页",
"close-active-tab": "关闭当前标签页", "close-active-tab": "关闭当前标签页",
"reopen-last-tab": "重新打开最后关闭的标签页", "reopen-last-tab": "重新打开最后关闭的标签页",
"activate-next-tab": "切换下一个标签页", "activate-next-tab": "切换下一个标签页",
"activate-previous-tab": "切换上一个标签页", "activate-previous-tab": "切换上一个标签页",
"open-new-window": "打开新窗口", "open-new-window": "打开新窗口",
"toggle-tray": "显示/隐藏系统托盘图标", "toggle-tray": "显示/隐藏系统托盘图标",
"first-tab": "切换到第一个标签页", "first-tab": "切换到第一个标签页",
"second-tab": "切换到第二个标签页", "second-tab": "切换到第二个标签页",
"third-tab": "切换到第三个标签页", "third-tab": "切换到第三个标签页",
"fourth-tab": "切换到第四个标签页", "fourth-tab": "切换到第四个标签页",
"fifth-tab": "切换到第五个标签页", "fifth-tab": "切换到第五个标签页",
"sixth-tab": "切换到第六个标签页", "sixth-tab": "切换到第六个标签页",
"seventh-tab": "切换到第七个标签页", "seventh-tab": "切换到第七个标签页",
"eight-tab": "切换到第八个标签页", "eight-tab": "切换到第八个标签页",
"ninth-tab": "切换到第九个标签页", "ninth-tab": "切换到第九个标签页",
"last-tab": "切换到最后一个标签页", "last-tab": "切换到最后一个标签页",
"dialogs": "对话框", "dialogs": "对话框",
"show-note-source": "显示笔记源代码对话框", "show-note-source": "显示笔记源代码对话框",
"show-options": "显示选项对话框", "show-options": "显示选项对话框",
"show-revisions": "显示修订历史对话框", "show-revisions": "显示修订历史对话框",
"show-recent-changes": "显示最近更改对话框", "show-recent-changes": "显示最近更改对话框",
"show-sql-console": "显示SQL控制台对话框", "show-sql-console": "显示SQL控制台对话框",
"show-backend-log": "显示后端日志对话框", "show-backend-log": "显示后端日志对话框",
"text-note-operations": "文本笔记操作", "text-note-operations": "文本笔记操作",
"add-link-to-text": "打开对话框以添加链接到文本", "add-link-to-text": "打开对话框以添加链接到文本",
"follow-link-under-cursor": "访问光标下的链接", "follow-link-under-cursor": "访问光标下的链接",
"insert-date-and-time-to-text": "在文本中插入日期和时间", "insert-date-and-time-to-text": "在文本中插入日期和时间",
"paste-markdown-into-text": "从剪贴板粘贴 Markdown 到文本笔记", "paste-markdown-into-text": "从剪贴板粘贴 Markdown 到文本笔记",
"cut-into-note": "剪切当前笔记的选区并创建包含选定文本的子笔记", "cut-into-note": "剪切当前笔记的选区并创建包含选定文本的子笔记",
"add-include-note-to-text": "打开对话框以添加一个包含笔记", "add-include-note-to-text": "打开对话框以添加一个包含笔记",
"edit-readonly-note": "编辑只读笔记", "edit-readonly-note": "编辑只读笔记",
"attributes-labels-and-relations": "属性(标签和关系)", "attributes-labels-and-relations": "属性(标签和关系)",
"add-new-label": "创建新标签", "add-new-label": "创建新标签",
"create-new-relation": "创建新关系", "create-new-relation": "创建新关系",
"ribbon-tabs": "功能区标签页", "ribbon-tabs": "功能区标签页",
"toggle-basic-properties": "切换基本属性", "toggle-basic-properties": "切换基本属性",
"toggle-file-properties": "切换文件属性", "toggle-file-properties": "切换文件属性",
"toggle-image-properties": "切换图像属性", "toggle-image-properties": "切换图像属性",
"toggle-owned-attributes": "切换拥有的属性", "toggle-owned-attributes": "切换拥有的属性",
"toggle-inherited-attributes": "切换继承的属性", "toggle-inherited-attributes": "切换继承的属性",
"toggle-promoted-attributes": "切换提升的属性", "toggle-promoted-attributes": "切换提升的属性",
"toggle-link-map": "切换链接地图", "toggle-link-map": "切换链接地图",
"toggle-note-info": "切换笔记信息", "toggle-note-info": "切换笔记信息",
"toggle-note-paths": "切换笔记路径", "toggle-note-paths": "切换笔记路径",
"toggle-similar-notes": "切换相似笔记", "toggle-similar-notes": "切换相似笔记",
"other": "其他", "other": "其他",
"toggle-right-pane": "切换右侧面板的显示,包括目录和高亮", "toggle-right-pane": "切换右侧面板的显示,包括目录和高亮",
"print-active-note": "打印当前笔记", "print-active-note": "打印当前笔记",
"open-note-externally": "以默认应用打开笔记文件", "open-note-externally": "以默认应用打开笔记文件",
"render-active-note": "渲染(重新渲染)当前笔记", "render-active-note": "渲染(重新渲染)当前笔记",
"run-active-note": "运行当前 JavaScript前/后端)代码笔记", "run-active-note": "运行当前 JavaScript前/后端)代码笔记",
"toggle-note-hoisting": "提升笔记", "toggle-note-hoisting": "提升笔记",
"unhoist": "取消提升笔记", "unhoist": "取消提升笔记",
"reload-frontend-app": "重新加载前端应用", "reload-frontend-app": "重新加载前端应用",
"open-dev-tools": "打开开发者工具", "open-dev-tools": "打开开发者工具",
"toggle-left-note-tree-panel": "切换左侧(笔记树)面板", "toggle-left-note-tree-panel": "切换左侧(笔记树)面板",
"toggle-full-screen": "切换全屏模式", "toggle-full-screen": "切换全屏模式",
"zoom-out": "缩小", "zoom-out": "缩小",
"zoom-in": "放大", "zoom-in": "放大",
"note-navigation": "笔记导航", "note-navigation": "笔记导航",
"reset-zoom-level": "重置缩放级别", "reset-zoom-level": "重置缩放级别",
"copy-without-formatting": "无格式复制选定文本", "copy-without-formatting": "无格式复制选定文本",
"force-save-revision": "强制创建/保存当前笔记的新修订版本", "force-save-revision": "强制创建/保存当前笔记的新修订版本",
"show-help": "显示帮助", "show-help": "显示帮助",
"toggle-book-properties": "切换书籍属性", "toggle-book-properties": "切换书籍属性",
"toggle-classic-editor-toolbar": "为编辑器切换格式标签页的固定工具栏", "toggle-classic-editor-toolbar": "为编辑器切换格式标签页的固定工具栏",
"export-as-pdf": "导出当前笔记为 PDF", "export-as-pdf": "导出当前笔记为 PDF",
"show-cheatsheet": "显示快捷键指南", "show-cheatsheet": "显示快捷键指南",
"toggle-zen-mode": "启用/禁用禅模式(为专注编辑而精简界面)", "toggle-zen-mode": "启用/禁用禅模式(为专注编辑而精简界面)",
"open-command-palette": "打开命令面板", "open-command-palette": "打开命令面板",
"quick-search": "激活快速搜索栏", "quick-search": "激活快速搜索栏",
"create-note-after": "在当前笔记后面创建笔记", "create-note-after": "在当前笔记后面创建笔记",
"create-note-into": "创建笔记作为当前笔记的子笔记", "create-note-into": "创建笔记作为当前笔记的子笔记",
"clone-notes-to": "克隆选中的笔记到", "clone-notes-to": "克隆选中的笔记到",
"move-notes-to": "移动选中的笔记到", "move-notes-to": "移动选中的笔记到",
"find-in-text": "在文本中查找", "find-in-text": "在文本中查找",
"back-in-note-history": "导航到历史记录中的上一个笔记", "back-in-note-history": "导航到历史记录中的上一个笔记",
"forward-in-note-history": "导航到历史记录的下一个笔记", "forward-in-note-history": "导航到历史记录的下一个笔记",
"scroll-to-active-note": "滚动笔记树到当前笔记" "scroll-to-active-note": "滚动笔记树到当前笔记"
}, },
"login": { "login": {
"title": "登录", "title": "登录",
"heading": "Trilium 登录", "heading": "Trilium 登录",
"incorrect-totp": "TOTP 不正确,请重试。", "incorrect-totp": "TOTP 不正确,请重试。",
"incorrect-password": "密码不正确,请重试。", "incorrect-password": "密码不正确,请重试。",
"password": "密码", "password": "密码",
"remember-me": "记住我", "remember-me": "记住我",
"button": "登录", "button": "登录",
"sign_in_with_sso": "使用 {{ ssoIssuerName }} 登录" "sign_in_with_sso": "使用 {{ ssoIssuerName }} 登录"
}, },
"set_password": { "set_password": {
"title": "设置密码", "title": "设置密码",
"heading": "设置密码", "heading": "设置密码",
"description": "在您能够从Web开始使用Trilium之前您需要先设置一个密码。您之后将使用此密码登录。", "description": "在您能够从Web开始使用Trilium之前您需要先设置一个密码。您之后将使用此密码登录。",
"password": "密码", "password": "密码",
"password-confirmation": "密码确认", "password-confirmation": "密码确认",
"button": "设置密码" "button": "设置密码"
}, },
"javascript-required": "Trilium需要启用JavaScript。", "javascript-required": "Trilium需要启用JavaScript。",
"setup": { "setup": {
"heading": "TriliumNext笔记设置", "heading": "TriliumNext笔记设置",
"new-document": "我是新用户我想为我的笔记创建一个新的Trilium文档", "new-document": "我是新用户我想为我的笔记创建一个新的Trilium文档",
"sync-from-desktop": "我已经有一个桌面实例,我想设置与它的同步", "sync-from-desktop": "我已经有一个桌面实例,我想设置与它的同步",
"sync-from-server": "我已经有一个服务器实例,我想设置与它的同步", "sync-from-server": "我已经有一个服务器实例,我想设置与它的同步",
"next": "下一步", "next": "下一步",
"init-in-progress": "文档初始化进行中", "init-in-progress": "文档初始化进行中",
"redirecting": "您将很快被重定向到应用程序。", "redirecting": "您将很快被重定向到应用程序。",
"title": "设置" "title": "设置"
}, },
"setup_sync-from-desktop": { "setup_sync-from-desktop": {
"heading": "从桌面同步", "heading": "从桌面同步",
"description": "此设置需要从桌面实例开始:", "description": "此设置需要从桌面实例开始:",
"step1": "打开您的TriliumNext笔记桌面实例。", "step1": "打开您的TriliumNext笔记桌面实例。",
"step2": "从Trilium菜单中点击“选项”。", "step2": "从Trilium菜单中点击“选项”。",
"step3": "点击“同步”类别。", "step3": "点击“同步”类别。",
"step4": "将服务器实例地址更改为:{{- host}} 并点击保存。", "step4": "将服务器实例地址更改为:{{- host}} 并点击保存。",
"step5": "点击“测试同步”按钮以验证连接是否成功。", "step5": "点击“测试同步”按钮以验证连接是否成功。",
"step6": "完成这些步骤后,点击{{- link}}。", "step6": "完成这些步骤后,点击{{- link}}。",
"step6-here": "这里" "step6-here": "这里"
}, },
"setup_sync-from-server": { "setup_sync-from-server": {
"heading": "从服务器同步", "heading": "从服务器同步",
"instructions": "请在下面输入Trilium服务器地址和凭据。这将从服务器下载整个Trilium文档并设置与它的同步。根据文档大小和您的连接的速度这可能需要一段时间。", "instructions": "请在下面输入Trilium服务器地址和凭据。这将从服务器下载整个Trilium文档并设置与它的同步。根据文档大小和您的连接的速度这可能需要一段时间。",
"server-host": "Trilium服务器地址", "server-host": "Trilium服务器地址",
"server-host-placeholder": "https://<主机名称>:<端口>", "server-host-placeholder": "https://<主机名称>:<端口>",
"proxy-server": "代理服务器(可选)", "proxy-server": "代理服务器(可选)",
"proxy-server-placeholder": "https://<主机名称>:<端口>", "proxy-server-placeholder": "https://<主机名称>:<端口>",
"note": "注意:", "note": "注意:",
"proxy-instruction": "如果您将代理设置留空,将使用系统代理(仅适用于桌面应用)", "proxy-instruction": "如果您将代理设置留空,将使用系统代理(仅适用于桌面应用)",
"password": "密码", "password": "密码",
"password-placeholder": "密码", "password-placeholder": "密码",
"back": "返回", "back": "返回",
"finish-setup": "完成设置" "finish-setup": "完成设置"
}, },
"setup_sync-in-progress": { "setup_sync-in-progress": {
"heading": "同步中", "heading": "同步中",
"successful": "同步已被正确设置。初始同步完成可能需要一些时间。完成后,您将被重定向到登录页面。", "successful": "同步已被正确设置。初始同步完成可能需要一些时间。完成后,您将被重定向到登录页面。",
"outstanding-items": "未完成的同步项目:", "outstanding-items": "未完成的同步项目:",
"outstanding-items-default": "无" "outstanding-items-default": "无"
}, },
"share_404": { "share_404": {
"title": "未找到", "title": "未找到",
"heading": "未找到" "heading": "未找到"
}, },
"share_page": { "share_page": {
"parent": "父级:", "parent": "父级:",
"clipped-from": "此笔记最初剪切自 {{- url}}", "clipped-from": "此笔记最初剪切自 {{- url}}",
"child-notes": "子笔记:", "child-notes": "子笔记:",
"no-content": "此笔记没有内容。" "no-content": "此笔记没有内容。"
}, },
"weekdays": { "weekdays": {
"monday": "周一", "monday": "周一",
"tuesday": "周二", "tuesday": "周二",
"wednesday": "周三", "wednesday": "周三",
"thursday": "周四", "thursday": "周四",
"friday": "周五", "friday": "周五",
"saturday": "周六", "saturday": "周六",
"sunday": "周日" "sunday": "周日"
}, },
"weekdayNumber": "第 {weekNumber} 周", "weekdayNumber": "第 {weekNumber} 周",
"months": { "months": {
"january": "一月", "january": "一月",
"february": "二月", "february": "二月",
"march": "三月", "march": "三月",
"april": "四月", "april": "四月",
"may": "五月", "may": "五月",
"june": "六月", "june": "六月",
"july": "七月", "july": "七月",
"august": "八月", "august": "八月",
"september": "九月", "september": "九月",
"october": "十月", "october": "十月",
"november": "十一月", "november": "十一月",
"december": "十二月" "december": "十二月"
}, },
"quarterNumber": "第 {quarterNumber} 季度", "quarterNumber": "第 {quarterNumber} 季度",
"special_notes": { "special_notes": {
"search_prefix": "搜索:" "search_prefix": "搜索:"
}, },
"test_sync": { "test_sync": {
"not-configured": "同步服务器主机未配置。请先配置同步。", "not-configured": "同步服务器主机未配置。请先配置同步。",
"successful": "同步服务器握手成功,同步已开始。" "successful": "同步服务器握手成功,同步已开始。"
}, },
"hidden-subtree": { "hidden-subtree": {
"root-title": "隐藏的笔记", "root-title": "隐藏的笔记",
"search-history-title": "搜索历史", "search-history-title": "搜索历史",
"note-map-title": "笔记地图", "note-map-title": "笔记地图",
"sql-console-history-title": "SQL 控制台历史", "sql-console-history-title": "SQL 控制台历史",
"shared-notes-title": "共享笔记", "shared-notes-title": "共享笔记",
"bulk-action-title": "批量操作", "bulk-action-title": "批量操作",
"backend-log-title": "后端日志", "backend-log-title": "后端日志",
"user-hidden-title": "隐藏的用户", "user-hidden-title": "隐藏的用户",
"launch-bar-templates-title": "启动栏模板", "launch-bar-templates-title": "启动栏模板",
"base-abstract-launcher-title": "基础摘要启动器", "base-abstract-launcher-title": "基础摘要启动器",
"command-launcher-title": "命令启动器", "command-launcher-title": "命令启动器",
"note-launcher-title": "笔记启动器", "note-launcher-title": "笔记启动器",
"script-launcher-title": "脚本启动器", "script-launcher-title": "脚本启动器",
"built-in-widget-title": "内置小组件", "built-in-widget-title": "内置小组件",
"spacer-title": "空白占位", "spacer-title": "空白占位",
"custom-widget-title": "自定义小组件", "custom-widget-title": "自定义小组件",
"launch-bar-title": "启动栏", "launch-bar-title": "启动栏",
"available-launchers-title": "可用启动器", "available-launchers-title": "可用启动器",
"go-to-previous-note-title": "跳转到上一条笔记", "go-to-previous-note-title": "跳转到上一条笔记",
"go-to-next-note-title": "跳转到下一条笔记", "go-to-next-note-title": "跳转到下一条笔记",
"new-note-title": "新建笔记", "new-note-title": "新建笔记",
"search-notes-title": "搜索笔记", "search-notes-title": "搜索笔记",
"calendar-title": "日历", "calendar-title": "日历",
"recent-changes-title": "最近更改", "recent-changes-title": "最近更改",
"bookmarks-title": "书签", "bookmarks-title": "书签",
"open-today-journal-note-title": "打开今天的日记笔记", "open-today-journal-note-title": "打开今天的日记笔记",
"quick-search-title": "快速搜索", "quick-search-title": "快速搜索",
"protected-session-title": "受保护的会话", "protected-session-title": "受保护的会话",
"sync-status-title": "同步状态", "sync-status-title": "同步状态",
"settings-title": "设置", "settings-title": "设置",
"options-title": "选项", "options-title": "选项",
"appearance-title": "外观", "appearance-title": "外观",
"shortcuts-title": "快捷键", "shortcuts-title": "快捷键",
"text-notes": "文本笔记", "text-notes": "文本笔记",
"code-notes-title": "代码笔记", "code-notes-title": "代码笔记",
"images-title": "图片", "images-title": "图片",
"spellcheck-title": "拼写检查", "spellcheck-title": "拼写检查",
"password-title": "密码", "password-title": "密码",
"multi-factor-authentication-title": "多因素认证", "multi-factor-authentication-title": "多因素认证",
"etapi-title": "ETAPI", "etapi-title": "ETAPI",
"backup-title": "备份", "backup-title": "备份",
"sync-title": "同步", "sync-title": "同步",
"other": "其他", "other": "其他",
"advanced-title": "高级", "advanced-title": "高级",
"visible-launchers-title": "可见启动器", "visible-launchers-title": "可见启动器",
"user-guide": "用户指南", "user-guide": "用户指南",
"localization": "语言和区域", "localization": "语言和区域",
"jump-to-note-title": "跳转至...", "jump-to-note-title": "跳转至...",
"llm-chat-title": "与笔记聊天", "llm-chat-title": "与笔记聊天",
"ai-llm-title": "AI/LLM", "ai-llm-title": "AI/LLM",
"inbox-title": "收件箱" "inbox-title": "收件箱"
}, },
"notes": { "notes": {
"new-note": "新建笔记", "new-note": "新建笔记",
"duplicate-note-suffix": "(重复)", "duplicate-note-suffix": "(重复)",
"duplicate-note-title": "{{- noteTitle }} {{ duplicateNoteSuffix }}" "duplicate-note-title": "{{- noteTitle }} {{ duplicateNoteSuffix }}"
}, },
"backend_log": { "backend_log": {
"log-does-not-exist": "后端日志文件 '{{ fileName }}' 暂不存在。", "log-does-not-exist": "后端日志文件 '{{ fileName }}' 暂不存在。",
"reading-log-failed": "读取后端日志文件 '{{ fileName }}' 失败。" "reading-log-failed": "读取后端日志文件 '{{ fileName }}' 失败。"
}, },
"content_renderer": { "content_renderer": {
"note-cannot-be-displayed": "此笔记类型无法显示。" "note-cannot-be-displayed": "此笔记类型无法显示。"
}, },
"pdf": { "pdf": {
"export_filter": "PDF 文档 (*.pdf)", "export_filter": "PDF 文档 (*.pdf)",
"unable-to-export-message": "当前笔记无法被导出为 PDF。", "unable-to-export-message": "当前笔记无法被导出为 PDF。",
"unable-to-export-title": "无法导出为 PDF", "unable-to-export-title": "无法导出为 PDF",
"unable-to-save-message": "所选文件不能被写入。重试或选择另一个目的地。" "unable-to-save-message": "所选文件不能被写入。重试或选择另一个目的地。"
}, },
"tray": { "tray": {
"tooltip": "TriliumNext 笔记", "tooltip": "TriliumNext 笔记",
"close": "退出 Trilium", "close": "退出 Trilium",
"recents": "最近笔记", "recents": "最近笔记",
"bookmarks": "书签", "bookmarks": "书签",
"today": "打开今天的日记笔记", "today": "打开今天的日记笔记",
"new-note": "新建笔记", "new-note": "新建笔记",
"show-windows": "显示窗口", "show-windows": "显示窗口",
"open_new_window": "打开新窗口" "open_new_window": "打开新窗口"
}, },
"migration": { "migration": {
"old_version": "由您当前版本的直接迁移不被支持。请先升级到最新的 v0.60.4 然后再到这个版本。", "old_version": "由您当前版本的直接迁移不被支持。请先升级到最新的 v0.60.4 然后再到这个版本。",
"error_message": "迁移到版本 {{version}} 时发生错误: {{stack}}", "error_message": "迁移到版本 {{version}} 时发生错误: {{stack}}",
"wrong_db_version": "数据库的版本({{version}})新于应用期望的版本({{targetVersion}}),这意味着它由一个更加新的且不兼容的 Trilium 所创建。升级到最新版的 Trilium 以解决此问题。" "wrong_db_version": "数据库的版本({{version}})新于应用期望的版本({{targetVersion}}),这意味着它由一个更加新的且不兼容的 Trilium 所创建。升级到最新版的 Trilium 以解决此问题。"
}, },
"modals": { "modals": {
"error_title": "错误" "error_title": "错误"
}, },
"keyboard_action_names": { "keyboard_action_names": {
"back-in-note-history": "返回笔记历史", "back-in-note-history": "返回笔记历史",
"forward-in-note-history": "前进笔记历史", "forward-in-note-history": "前进笔记历史",
"jump-to-note": "跳转到...", "jump-to-note": "跳转到...",
"command-palette": "命令面板", "command-palette": "命令面板",
"scroll-to-active-note": "滚动到当前笔记", "scroll-to-active-note": "滚动到当前笔记",
"quick-search": "快速搜索", "quick-search": "快速搜索",
"search-in-subtree": "在子树中搜索", "search-in-subtree": "在子树中搜索",
"expand-subtree": "展开子树", "expand-subtree": "展开子树",
"collapse-tree": "折叠整个树", "collapse-tree": "折叠整个树",
"collapse-subtree": "折叠子树", "collapse-subtree": "折叠子树",
"sort-child-notes": "排序子笔记", "sort-child-notes": "排序子笔记",
"create-note-after": "在后面创建笔记", "create-note-after": "在后面创建笔记",
"create-note-into": "创建笔记到", "create-note-into": "创建笔记到",
"create-note-into-inbox": "创建笔记到收件箱", "create-note-into-inbox": "创建笔记到收件箱",
"delete-notes": "删除笔记", "delete-notes": "删除笔记",
"move-note-up": "上移笔记", "move-note-up": "上移笔记",
"move-note-down": "下移笔记", "move-note-down": "下移笔记",
"move-note-up-in-hierarchy": "在层级中上移笔记", "move-note-up-in-hierarchy": "在层级中上移笔记",
"move-note-down-in-hierarchy": "在层级中下移笔记", "move-note-down-in-hierarchy": "在层级中下移笔记",
"edit-note-title": "编辑笔记标题", "edit-note-title": "编辑笔记标题",
"edit-branch-prefix": "编辑分支前缀", "edit-branch-prefix": "编辑分支前缀",
"clone-notes-to": "克隆笔记到", "clone-notes-to": "克隆笔记到",
"move-notes-to": "移动笔记到", "move-notes-to": "移动笔记到",
"copy-notes-to-clipboard": "复制笔记到剪贴板", "copy-notes-to-clipboard": "复制笔记到剪贴板",
"paste-notes-from-clipboard": "从剪贴板粘贴笔记", "paste-notes-from-clipboard": "从剪贴板粘贴笔记",
"cut-notes-to-clipboard": "剪切笔记到剪贴板", "cut-notes-to-clipboard": "剪切笔记到剪贴板",
"select-all-notes-in-parent": "选择父节点中所有笔记", "select-all-notes-in-parent": "选择父节点中所有笔记",
"zoom-in": "放大", "zoom-in": "放大",
"zoom-out": "缩小", "zoom-out": "缩小",
"reset-zoom-level": "重置缩放级别", "reset-zoom-level": "重置缩放级别",
"copy-without-formatting": "无格式复制", "copy-without-formatting": "无格式复制",
"force-save-revision": "强制保存修订版本", "force-save-revision": "强制保存修订版本",
"add-note-above-to-selection": "将上方笔记添加到选择", "add-note-above-to-selection": "将上方笔记添加到选择",
"add-note-below-to-selection": "将下方笔记添加到选择", "add-note-below-to-selection": "将下方笔记添加到选择",
"duplicate-subtree": "复制子树", "duplicate-subtree": "复制子树",
"open-new-tab": "打开新标签页", "open-new-tab": "打开新标签页",
"close-active-tab": "关闭当前标签页", "close-active-tab": "关闭当前标签页",
"reopen-last-tab": "重新打开最后关闭的标签页", "reopen-last-tab": "重新打开最后关闭的标签页",
"activate-next-tab": "切换下一个标签页", "activate-next-tab": "切换下一个标签页",
"activate-previous-tab": "切换上一个标签页", "activate-previous-tab": "切换上一个标签页",
"open-new-window": "打开新窗口", "open-new-window": "打开新窗口",
"toggle-system-tray-icon": "显示/隐藏系统托盘图标", "toggle-system-tray-icon": "显示/隐藏系统托盘图标",
"toggle-zen-mode": "启用/禁用禅模式", "toggle-zen-mode": "启用/禁用禅模式",
"switch-to-first-tab": "切换到第一个标签页", "switch-to-first-tab": "切换到第一个标签页",
"switch-to-second-tab": "切换到第二个标签页", "switch-to-second-tab": "切换到第二个标签页",
"switch-to-third-tab": "切换到第三个标签页", "switch-to-third-tab": "切换到第三个标签页",
"switch-to-fourth-tab": "切换到第四个标签页", "switch-to-fourth-tab": "切换到第四个标签页",
"switch-to-fifth-tab": "切换到第五个标签页", "switch-to-fifth-tab": "切换到第五个标签页",
"switch-to-sixth-tab": "切换到第六个标签页", "switch-to-sixth-tab": "切换到第六个标签页",
"switch-to-seventh-tab": "切换到第七个标签页", "switch-to-seventh-tab": "切换到第七个标签页",
"switch-to-eighth-tab": "切换到第八个标签页", "switch-to-eighth-tab": "切换到第八个标签页",
"switch-to-ninth-tab": "切换到第九个标签页", "switch-to-ninth-tab": "切换到第九个标签页",
"switch-to-last-tab": "切换到最后一个标签页", "switch-to-last-tab": "切换到最后一个标签页",
"show-note-source": "显示笔记源代码", "show-note-source": "显示笔记源代码",
"show-options": "显示选项", "show-options": "显示选项",
"show-revisions": "显示修订历史", "show-revisions": "显示修订历史",
"show-recent-changes": "显示最近更改", "show-recent-changes": "显示最近更改",
"show-sql-console": "显示SQL控制台", "show-sql-console": "显示SQL控制台",
"show-backend-log": "显示后端日志", "show-backend-log": "显示后端日志",
"show-help": "显示帮助", "show-help": "显示帮助",
"show-cheatsheet": "显示快捷键指南", "show-cheatsheet": "显示快捷键指南",
"add-link-to-text": "为文本添加链接", "add-link-to-text": "为文本添加链接",
"follow-link-under-cursor": "访问光标下的链接", "follow-link-under-cursor": "访问光标下的链接",
"insert-date-and-time-to-text": "在文本中插入日期和时间", "insert-date-and-time-to-text": "在文本中插入日期和时间",
"paste-markdown-into-text": "粘贴Markdown到文本", "paste-markdown-into-text": "粘贴Markdown到文本",
"cut-into-note": "剪切到笔记", "cut-into-note": "剪切到笔记",
"add-include-note-to-text": "在文本中添加包含笔记", "add-include-note-to-text": "在文本中添加包含笔记",
"edit-read-only-note": "编辑只读笔记", "edit-read-only-note": "编辑只读笔记",
"add-new-label": "添加新标签", "add-new-label": "添加新标签",
"add-new-relation": "添加新关系", "add-new-relation": "添加新关系",
"toggle-ribbon-tab-classic-editor": "切换功能区标签:经典编辑器", "toggle-ribbon-tab-classic-editor": "切换功能区标签:经典编辑器",
"toggle-ribbon-tab-basic-properties": "切换功能区标签:基本属性", "toggle-ribbon-tab-basic-properties": "切换功能区标签:基本属性",
"toggle-ribbon-tab-book-properties": "切换功能区标签:书籍属性", "toggle-ribbon-tab-book-properties": "切换功能区标签:书籍属性",
"toggle-ribbon-tab-file-properties": "切换功能区标签:文件属性", "toggle-ribbon-tab-file-properties": "切换功能区标签:文件属性",
"toggle-ribbon-tab-image-properties": "切换功能区标签:图片属性", "toggle-ribbon-tab-image-properties": "切换功能区标签:图片属性",
"toggle-ribbon-tab-owned-attributes": "切换功能区标签:自有属性", "toggle-ribbon-tab-owned-attributes": "切换功能区标签:自有属性",
"toggle-ribbon-tab-inherited-attributes": "切换功能区标签:继承属性", "toggle-ribbon-tab-inherited-attributes": "切换功能区标签:继承属性",
"toggle-ribbon-tab-promoted-attributes": "切换功能区标签:提升属性", "toggle-ribbon-tab-promoted-attributes": "切换功能区标签:提升属性",
"toggle-ribbon-tab-note-map": "切换功能区标签:笔记地图", "toggle-ribbon-tab-note-map": "切换功能区标签:笔记地图",
"toggle-ribbon-tab-note-info": "切换功能区标签:笔记信息", "toggle-ribbon-tab-note-info": "切换功能区标签:笔记信息",
"toggle-ribbon-tab-note-paths": "切换功能区标签:笔记路径", "toggle-ribbon-tab-note-paths": "切换功能区标签:笔记路径",
"toggle-ribbon-tab-similar-notes": "切换功能区标签:相似笔记", "toggle-ribbon-tab-similar-notes": "切换功能区标签:相似笔记",
"toggle-right-pane": "切换右侧面板", "toggle-right-pane": "切换右侧面板",
"print-active-note": "打印当前笔记", "print-active-note": "打印当前笔记",
"export-active-note-as-pdf": "导出当前笔记为 PDF", "export-active-note-as-pdf": "导出当前笔记为 PDF",
"open-note-externally": "在外部打开笔记", "open-note-externally": "在外部打开笔记",
"render-active-note": "渲染当前笔记", "render-active-note": "渲染当前笔记",
"run-active-note": "运行当前笔记", "run-active-note": "运行当前笔记",
"toggle-note-hoisting": "提升笔记", "toggle-note-hoisting": "提升笔记",
"unhoist-note": "取消提升笔记", "unhoist-note": "取消提升笔记",
"reload-frontend-app": "重新加载前端应用", "reload-frontend-app": "重新加载前端应用",
"open-developer-tools": "打开开发者工具", "open-developer-tools": "打开开发者工具",
"find-in-text": "在文本中查找", "find-in-text": "在文本中查找",
"toggle-left-pane": "切换左侧面板", "toggle-left-pane": "切换左侧面板",
"toggle-full-screen": "切换全屏模式" "toggle-full-screen": "切换全屏模式"
}, },
"share_theme": { "share_theme": {
"site-theme": "网站主题", "site-theme": "网站主题",
"search_placeholder": "搜索...", "search_placeholder": "搜索...",
"image_alt": "文章图片", "image_alt": "文章图片",
"last-updated": "最后更新于 {{- date}}", "last-updated": "最后更新于 {{- date}}",
"subpages": "子页面:", "subpages": "子页面:",
"on-this-page": "本页内容", "on-this-page": "本页内容",
"expand": "展开" "expand": "展开"
}, },
"hidden_subtree_templates": { "hidden_subtree_templates": {
"text-snippet": "文本片段", "text-snippet": "文本片段",
"description": "描述", "description": "描述",
"list-view": "列表视图", "list-view": "列表视图",
"grid-view": "网格视图", "grid-view": "网格视图",
"calendar": "日历", "calendar": "日历",
"table": "表格", "table": "表格",
"geo-map": "地理地图", "geo-map": "地理地图",
"start-date": "开始日期", "start-date": "开始日期",
"end-date": "结束日期", "end-date": "结束日期",
"start-time": "开始时间", "start-time": "开始时间",
"end-time": "结束时间", "end-time": "结束时间",
"geolocation": "地理位置", "geolocation": "地理位置",
"built-in-templates": "内置模板", "built-in-templates": "内置模板",
"board": "看板", "board": "看板",
"status": "状态", "status": "状态",
"board_note_first": "第一个笔记", "board_note_first": "第一个笔记",
"board_note_second": "第二个笔记", "board_note_second": "第二个笔记",
"board_note_third": "第三个笔记", "board_note_third": "第三个笔记",
"board_status_todo": "待办", "board_status_todo": "待办",
"board_status_progress": "进行中", "board_status_progress": "进行中",
"board_status_done": "已完成" "board_status_done": "已完成"
} },
"sql_init": {
"db_not_initialized_desktop": "数据库尚未初始化,请依照屏幕提示操作。",
"db_not_initialized_server": "数据库尚未初始化,请访问设置页面 http://[your-server-host]:{{port}} 查看如何初始化 Trilium。"
}
} }

View File

@ -7,6 +7,48 @@
"scroll-to-active-note": "Scroll naar actieve notitie in de notitieboom", "scroll-to-active-note": "Scroll naar actieve notitie in de notitieboom",
"quick-search": "Snelle zoekbalk activeren", "quick-search": "Snelle zoekbalk activeren",
"search-in-subtree": "Zoek naar notities in de subboom van de actieve notitie", "search-in-subtree": "Zoek naar notities in de subboom van de actieve notitie",
"expand-subtree": "Subboom van huidige notitie uitbreiden" "expand-subtree": "Subboom van huidige notitie uitbreiden",
"collapse-tree": "Vouwt de volledige notitieboom samen",
"collapse-subtree": "Vouwt de subboom van de huidige notitie samen",
"sort-child-notes": "Kindnotities sorteren",
"creating-and-moving-notes": "Notities maken en verplaatsen",
"create-note-after": "Maak notitie na actieve notitie",
"create-note-into": "Maak notitie als onderliggende notitie van actieve notitie",
"create-note-into-inbox": "Maak een notitie in de inbox (indien gedefinieerd) of dagnotitie",
"delete-note": "Notitie verwijderen",
"move-note-up": "Notitie naar boven verplaatsen",
"move-note-down": "Notitie naar beneden verplaatsen",
"move-note-up-in-hierarchy": "Notitie hoger in hiërarchie plaatsen",
"move-note-down-in-hierarchy": "Verplaats nota in hiërarchie",
"edit-note-title": "Spring van de boom naar de notitie en de titel",
"edit-branch-prefix": "Dialoogvenster \"Bewerk takvoorvoegsel\" weergeven",
"clone-notes-to": "Geselecteerde notities klonen",
"move-notes-to": "Geselecteerde notities verplaatsen",
"note-clipboard": "Notitieblok",
"copy-notes-to-clipboard": "Kopieer geselecteerde notities naar het klembord",
"paste-notes-from-clipboard": "Plak notities uit het klembord in de actieve notitie",
"cut-notes-to-clipboard": "Geselecteerde notities naar het klembord knippen",
"select-all-notes-in-parent": "Selecteer alle notities van het huidige notitieniveau",
"add-note-above-to-the-selection": "Voeg bovenstaande opmerking toe aan de selectie",
"add-note-below-to-selection": "Voeg onderstaande opmerking toe aan de selectie",
"duplicate-subtree": "Duplicaat subboom",
"tabs-and-windows": "Tabbladen en vensters",
"open-new-tab": "Nieuw tabblad openen",
"close-active-tab": "Sluit actief tabblad",
"reopen-last-tab": "Het laatst gesloten tabblad opnieuw openen",
"activate-next-tab": "Tabblad rechts activeren",
"activate-previous-tab": "Tabblad links activeren",
"open-new-window": "Nieuw leeg venster openen",
"toggle-tray": "De toepassing weergeven/verbergen in het systeemvak",
"first-tab": "Activeer het eerste tabblad in de lijst",
"second-tab": "Activeer het tweede tabblad in de lijst",
"third-tab": "Activeer het derde tabblad in de lijst",
"fourth-tab": "Activeer het vierde tabblad in de lijst",
"fifth-tab": "Activeer het vijfde tabblad in de lijst",
"sixth-tab": "Activeer het zesde tabblad in de lijst",
"seventh-tab": "Activeer het zevende tabblad in de lijst",
"eight-tab": "Activeer het achtste tabblad in de lijst",
"ninth-tab": "Activeer het negende tabblad in de lijst",
"last-tab": "Activeer het laatste tabblad in de lijst"
} }
} }

View File

@ -424,5 +424,9 @@
"board_status_todo": "待辦", "board_status_todo": "待辦",
"board_status_progress": "進行中", "board_status_progress": "進行中",
"board_status_done": "已完成" "board_status_done": "已完成"
},
"sql_init": {
"db_not_initialized_desktop": "資料庫尚未初始化,請依螢幕指示操作。",
"db_not_initialized_server": "資料庫尚未初始化,請前往設定頁面 http://[your-server-host]:{{port}} 查看如何初始化 Trilium。"
} }
} }

View File

@ -163,6 +163,7 @@ function setExpandedForSubtree(req: Request) {
SELECT branches.branchId, branches.noteId FROM branches SELECT branches.branchId, branches.noteId FROM branches
JOIN tree ON branches.parentNoteId = tree.noteId JOIN tree ON branches.parentNoteId = tree.noteId
WHERE branches.isDeleted = 0 WHERE branches.isDeleted = 0
AND branches.isExpanded = 1
) )
SELECT branchId FROM tree`, SELECT branchId FROM tree`,
[branchId] [branchId]

View File

@ -26,20 +26,8 @@ function checkAuth(req: Request, res: Response, next: NextFunction) {
if (isElectron || noAuthentication) { if (isElectron || noAuthentication) {
next(); next();
return; return;
} else if (currentTotpStatus !== lastAuthState.totpEnabled || currentSsoStatus !== lastAuthState.ssoEnabled) {
req.session.destroy((err) => {
if (err) console.error('Error destroying session:', err);
res.redirect('login');
});
return;
} else if (currentSsoStatus) {
if (req.oidc?.isAuthenticated() && req.session.loggedIn) {
next();
return;
}
res.redirect('login');
return;
} else if (!req.session.loggedIn && !noAuthentication) { } else if (!req.session.loggedIn && !noAuthentication) {
// check redirectBareDomain option first
// cannot use options.getOptionBool currently => it will throw an error on new installations // cannot use options.getOptionBool currently => it will throw an error on new installations
// TriliumNextTODO: look into potentially creating an getOptionBoolOrNull instead // TriliumNextTODO: look into potentially creating an getOptionBoolOrNull instead
@ -54,6 +42,19 @@ function checkAuth(req: Request, res: Response, next: NextFunction) {
} }
} }
res.redirect(hasRedirectBareDomain ? "share" : "login"); res.redirect(hasRedirectBareDomain ? "share" : "login");
} else if (currentTotpStatus !== lastAuthState.totpEnabled || currentSsoStatus !== lastAuthState.ssoEnabled) {
req.session.destroy((err) => {
if (err) console.error('Error destroying session:', err);
res.redirect('login');
});
return;
} else if (currentSsoStatus) {
if (req.oidc?.isAuthenticated() && req.session.loggedIn) {
next();
return;
}
res.redirect('login');
return;
} else { } else {
next(); next();
} }

14
pnpm-lock.yaml generated
View File

@ -567,8 +567,8 @@ importers:
specifier: 0.5.0 specifier: 0.5.0
version: 0.5.0 version: 0.5.0
axios: axios:
specifier: 1.11.0 specifier: 1.12.0
version: 1.11.0(debug@4.4.1) version: 1.12.0(debug@4.4.1)
bindings: bindings:
specifier: 1.5.0 specifier: 1.5.0
version: 1.5.0 version: 1.5.0
@ -5842,8 +5842,8 @@ packages:
resolution: {integrity: sha512-zJAaP9zxTcvTHRlejau3ZOY4V7SRpiByf3/dxx2uyKxxor19tpmpV2QRsTKikckwhaPmr2dVpxxMr7jOCYVp5g==} resolution: {integrity: sha512-zJAaP9zxTcvTHRlejau3ZOY4V7SRpiByf3/dxx2uyKxxor19tpmpV2QRsTKikckwhaPmr2dVpxxMr7jOCYVp5g==}
engines: {node: '>=6.0.0'} engines: {node: '>=6.0.0'}
axios@1.11.0: axios@1.12.0:
resolution: {integrity: sha512-1Lx3WLFQWm3ooKDYZD1eXmoGO9fxYQjrycfHFC8P0sCfQVXyROp0p9PFWBehewBOdCwHc+f/b8I0fMto5eSfwA==} resolution: {integrity: sha512-oXTDccv8PcfjZmPGlWsPSwtOJCZ/b6W5jAMCNcfwJbCzDckwG0jrYJFaWH1yvivfCXjVzV/SPDEhMB3Q+DSurg==}
axobject-query@4.1.0: axobject-query@4.1.0:
resolution: {integrity: sha512-qIj0G9wZbMGNLjLmg1PT6v2mE9AH2zlnADJD/2tC6E00hgmhUOfEB6greHPAfLRSufHqROIUTkw6E+M3lH0PTQ==} resolution: {integrity: sha512-qIj0G9wZbMGNLjLmg1PT6v2mE9AH2zlnADJD/2tC6E00hgmhUOfEB6greHPAfLRSufHqROIUTkw6E+M3lH0PTQ==}
@ -15113,8 +15113,6 @@ snapshots:
'@ckeditor/ckeditor5-table': 46.1.0 '@ckeditor/ckeditor5-table': 46.1.0
'@ckeditor/ckeditor5-utils': 46.1.0 '@ckeditor/ckeditor5-utils': 46.1.0
ckeditor5: 46.1.0(patch_hash=8331a09d41443b39ea1c784daaccfeb0da4f9065ed556e7de92e9c77edd9eb41) ckeditor5: 46.1.0(patch_hash=8331a09d41443b39ea1c784daaccfeb0da4f9065ed556e7de92e9c77edd9eb41)
transitivePeerDependencies:
- supports-color
'@ckeditor/ckeditor5-emoji@46.1.0': '@ckeditor/ckeditor5-emoji@46.1.0':
dependencies: dependencies:
@ -20474,7 +20472,7 @@ snapshots:
await-to-js@3.0.0: {} await-to-js@3.0.0: {}
axios@1.11.0(debug@4.4.1): axios@1.12.0(debug@4.4.1):
dependencies: dependencies:
follow-redirects: 1.15.9(debug@4.4.1) follow-redirects: 1.15.9(debug@4.4.1)
form-data: 4.0.4 form-data: 4.0.4
@ -20967,6 +20965,8 @@ snapshots:
ckeditor5-collaboration@46.1.0: ckeditor5-collaboration@46.1.0:
dependencies: dependencies:
'@ckeditor/ckeditor5-collaboration-core': 46.1.0 '@ckeditor/ckeditor5-collaboration-core': 46.1.0
transitivePeerDependencies:
- supports-color
ckeditor5-premium-features@46.1.0(bufferutil@4.0.9)(ckeditor5@46.1.0(patch_hash=8331a09d41443b39ea1c784daaccfeb0da4f9065ed556e7de92e9c77edd9eb41))(utf-8-validate@6.0.5): ckeditor5-premium-features@46.1.0(bufferutil@4.0.9)(ckeditor5@46.1.0(patch_hash=8331a09d41443b39ea1c784daaccfeb0da4f9065ed556e7de92e9c77edd9eb41))(utf-8-validate@6.0.5):
dependencies: dependencies:

79
scripts/fix-html-links.ts Normal file
View File

@ -0,0 +1,79 @@
#!/usr/bin/env node
/**
* Post-process HTML files generated by MkDocs to remove .md extensions from links
*/
import * as fs from 'fs';
import * as path from 'path';
/**
* Process HTML content to remove .md extensions from links
*/
function fixHtmlLinks(content: string): string {
// Replace .md extensions in href attributes
// Handle both quoted and unquoted href attributes
// First, handle quoted hrefs: href="...something.md" or href="...something.md#anchor"
content = content.replace(/href="([^"]*?)\.md(#[^"]*)?"/g, 'href="$1$2"');
// Then, handle unquoted hrefs: href=...something.md or href=...something.md#anchor
// This matches href= followed by a non-whitespace URL ending in .md
content = content.replace(/href=([^\s>]*?)\.md(#[^\s>]*)?(?=[\s>])/g, 'href=$1$2');
return content;
}
/**
* Recursively process all HTML files in a directory
*/
function processDirectory(dir: string): number {
let filesProcessed = 0;
const entries = fs.readdirSync(dir, { withFileTypes: true });
for (const entry of entries) {
const fullPath = path.join(dir, entry.name);
if (entry.isDirectory()) {
// Recursively process subdirectories
filesProcessed += processDirectory(fullPath);
} else if (entry.isFile() && entry.name.endsWith('.html')) {
// Process HTML files
const content = fs.readFileSync(fullPath, 'utf-8');
const fixedContent = fixHtmlLinks(content);
if (content !== fixedContent) {
fs.writeFileSync(fullPath, fixedContent, 'utf-8');
console.log(`Fixed: ${path.relative(process.cwd(), fullPath)}`);
filesProcessed++;
}
}
}
return filesProcessed;
}
function main(): number {
const args = process.argv.slice(2);
const siteDir = args[0] || 'site';
const fullPath = path.resolve(siteDir);
if (!fs.existsSync(fullPath)) {
console.error(`Error: Directory '${fullPath}' does not exist`);
return 1;
}
console.log(`Processing HTML files in: ${fullPath}`);
console.log('-'.repeat(50));
const filesProcessed = processDirectory(fullPath);
console.log('-'.repeat(50));
console.log(`Processed ${filesProcessed} HTML files`);
return 0;
}
// Run the main function
process.exit(main());