oceanpress 1.0.13 → 1.0.15
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 +45 -1
- package/README_EN.md +131 -0
- package/dist-cli/cli.js +4 -5
- package/dist-cli/cli.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
这个是 OceanPress 的核心库,包含了前端应用和命令行程序。
|
|
4
4
|
|
|
5
|
+
**[English Documentation](./README_EN.md)** | 简体中文
|
|
6
|
+
|
|
5
7
|
## CLI 命令详解
|
|
6
8
|
|
|
7
9
|
### 1. 构建静态站点 (build)
|
|
@@ -9,16 +11,26 @@
|
|
|
9
11
|
将思源笔记本的内容转换为静态网站:
|
|
10
12
|
|
|
11
13
|
```bash
|
|
12
|
-
oceanpress build -c <配置文件路径> -o <输出目录>
|
|
14
|
+
oceanpress build -c <配置文件路径> -o <输出目录> [选项]
|
|
13
15
|
```
|
|
14
16
|
|
|
15
17
|
**选项:**
|
|
16
18
|
- `-c, --config <string>` - 指定配置文件的位置
|
|
17
19
|
- `-o, --output <string>` - 指定输出目录位置
|
|
20
|
+
- `--md` - 自动启用 Markdown 镜像导出(等同于在配置文件中设置 markdownMirror.enable = true)
|
|
21
|
+
- `--watch` - 启用监听模式,自动重新构建
|
|
22
|
+
- `--watch-interval <number>` - 监听模式的检查间隔(秒),默认 60 秒
|
|
18
23
|
|
|
19
24
|
**示例:**
|
|
20
25
|
```bash
|
|
26
|
+
# 基础构建
|
|
21
27
|
oceanpress build -c ./config.json -o ./dist
|
|
28
|
+
|
|
29
|
+
# 构建并启用 Markdown 镜像导出
|
|
30
|
+
oceanpress build -c ./config.json -o ./dist --md
|
|
31
|
+
|
|
32
|
+
# 启用监听模式,每 30 秒检查一次更新
|
|
33
|
+
oceanpress build -c ./config.json -o ./dist --watch --watch-interval 30
|
|
22
34
|
```
|
|
23
35
|
|
|
24
36
|
### 2. 启动开发服务器 (server)
|
|
@@ -74,6 +86,38 @@ OceanPress 使用 JSON 格式的配置文件来定义站点的基本信息和构
|
|
|
74
86
|
- 主题和样式设置
|
|
75
87
|
- 插件配置
|
|
76
88
|
|
|
89
|
+
### MarkdownMirror 插件配置
|
|
90
|
+
|
|
91
|
+
MarkdownMirror 插件可以自动将生成的 HTML 文档转换为 Markdown 格式,便于与 NotebookLM 等工具集成。
|
|
92
|
+
|
|
93
|
+
**配置示例:**
|
|
94
|
+
```json
|
|
95
|
+
{
|
|
96
|
+
"markdownMirror": {
|
|
97
|
+
"enable": true,
|
|
98
|
+
"outputDir": "/path/to/output",
|
|
99
|
+
"includeAssets": false
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
**配置选项:**
|
|
105
|
+
- `enable` - 是否启用 Markdown 镜像导出
|
|
106
|
+
- `outputDir` - Markdown 文件输出目录(通常与构建输出目录相同)
|
|
107
|
+
- `includeAssets` - 是否同步资源文件(图片、附件等),默认 false
|
|
108
|
+
|
|
109
|
+
**功能特性:**
|
|
110
|
+
- 自动将 HTML 文档转换为 Markdown 格式
|
|
111
|
+
- 自动删除生成的 HTML 文件,仅保留 Markdown
|
|
112
|
+
- 智能转换内部链接(.html → .md + 标题锚点)
|
|
113
|
+
- 移除思源模板生成的多余内容(版权信息、SiYuan 相关链接等)
|
|
114
|
+
- 优化代码块格式和空白字符
|
|
115
|
+
|
|
116
|
+
**使用方式:**
|
|
117
|
+
1. 在配置文件中启用 `markdownMirror.enable = true`
|
|
118
|
+
2. 运行 `oceanpress build --md` 或直接在配置中设置
|
|
119
|
+
3. 输出目录将生成 Markdown 文件,可直接导入 NotebookLM
|
|
120
|
+
|
|
77
121
|
## 技术栈
|
|
78
122
|
|
|
79
123
|
- Vue 3
|
package/README_EN.md
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# OceanPress Frontend
|
|
2
|
+
|
|
3
|
+
This is the core library of OceanPress, including the frontend application and command-line tool.
|
|
4
|
+
|
|
5
|
+
English | **[简体中文文档](./README.md)**
|
|
6
|
+
|
|
7
|
+
## CLI Commands
|
|
8
|
+
|
|
9
|
+
### 1. Build Static Site (build)
|
|
10
|
+
|
|
11
|
+
Convert SiYuan notebook content to a static website:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
oceanpress build -c <config_path> -o <output_dir> [options]
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
**Options:**
|
|
18
|
+
- `-c, --config <string>` - Specify the configuration file location
|
|
19
|
+
- `-o, --output <string>` - Specify the output directory location
|
|
20
|
+
- `--md` - Automatically enable Markdown mirror export (equivalent to setting markdownMirror.enable = true in config)
|
|
21
|
+
- `--watch` - Enable watch mode for automatic rebuilds
|
|
22
|
+
- `--watch-interval <number>` - Check interval for watch mode (seconds), default 60 seconds
|
|
23
|
+
|
|
24
|
+
**Examples:**
|
|
25
|
+
```bash
|
|
26
|
+
# Basic build
|
|
27
|
+
oceanpress build -c ./config.json -o ./dist
|
|
28
|
+
|
|
29
|
+
# Build with Markdown mirror export
|
|
30
|
+
oceanpress build -c ./config.json -o ./dist --md
|
|
31
|
+
|
|
32
|
+
# Enable watch mode with 30-second interval
|
|
33
|
+
oceanpress build -c ./config.json -o ./dist --watch --watch-interval 30
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### 2. Start Development Server (server)
|
|
37
|
+
|
|
38
|
+
Run a dynamic proxy server for development and preview:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
oceanpress server -c <config_path>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**Options:**
|
|
45
|
+
- `-c, --config <string>` - Specify the configuration file location
|
|
46
|
+
- `-h, --host <string>` - Web service binding address (default: 127.0.0.1)
|
|
47
|
+
- `-p, --port <number>` - Web service binding port (default: 80)
|
|
48
|
+
- `--cache <boolean>` - Set to true to enable caching, default false
|
|
49
|
+
|
|
50
|
+
**Examples:**
|
|
51
|
+
```bash
|
|
52
|
+
# Use default port
|
|
53
|
+
oceanpress server -c ./config.json
|
|
54
|
+
|
|
55
|
+
# Specify port and host
|
|
56
|
+
oceanpress server -c ./config.json -p 3000 -h 0.0.0.0
|
|
57
|
+
|
|
58
|
+
# Enable caching
|
|
59
|
+
oceanpress server -c ./config.json --cache true
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### 3. Deploy Site (deploy)
|
|
63
|
+
|
|
64
|
+
Deploy the generated site to a remote server:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
oceanpress deploy -c <config_path> -h <api_url> -k <api_key>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
**Options:**
|
|
71
|
+
- `-c, --config <string>` - Specify the configuration file location
|
|
72
|
+
- `-h, --apiBase <string>` - OceanPress server address
|
|
73
|
+
- `-k, --apiKey <string>` - OceanPress server API key
|
|
74
|
+
|
|
75
|
+
**Examples:**
|
|
76
|
+
```bash
|
|
77
|
+
oceanpress deploy -c ./config.json -h https://api.example.com -k your-api-key
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Configuration File
|
|
81
|
+
|
|
82
|
+
OceanPress uses JSON format configuration files to define site information and build parameters. Configuration files typically include:
|
|
83
|
+
|
|
84
|
+
- Site name and description
|
|
85
|
+
- SiYuan notebook connection configuration
|
|
86
|
+
- Theme and style settings
|
|
87
|
+
- Plugin configuration
|
|
88
|
+
|
|
89
|
+
### MarkdownMirror Plugin Configuration
|
|
90
|
+
|
|
91
|
+
The MarkdownMirror plugin automatically converts generated HTML documents to Markdown format, making it easy to integrate with tools like NotebookLM.
|
|
92
|
+
|
|
93
|
+
**Configuration Example:**
|
|
94
|
+
```json
|
|
95
|
+
{
|
|
96
|
+
"markdownMirror": {
|
|
97
|
+
"enable": true,
|
|
98
|
+
"outputDir": "/path/to/output",
|
|
99
|
+
"includeAssets": false
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
**Configuration Options:**
|
|
105
|
+
- `enable` - Enable Markdown mirror export
|
|
106
|
+
- `outputDir` - Markdown file output directory (usually same as build output directory)
|
|
107
|
+
- `includeAssets` - Whether to sync asset files (images, attachments, etc.), default false
|
|
108
|
+
|
|
109
|
+
**Features:**
|
|
110
|
+
- Automatically convert HTML documents to Markdown format
|
|
111
|
+
- Automatically delete generated HTML files, keeping only Markdown
|
|
112
|
+
- Smart internal link conversion (.html → .md + title anchors)
|
|
113
|
+
- Remove redundant template content (copyright info, SiYuan links, etc.)
|
|
114
|
+
- Optimize code blocks and whitespace
|
|
115
|
+
|
|
116
|
+
**Usage:**
|
|
117
|
+
1. Enable `markdownMirror.enable = true` in configuration file
|
|
118
|
+
2. Run `oceanpress build --md` or set directly in configuration
|
|
119
|
+
3. Output directory will contain Markdown files, ready to import into NotebookLM
|
|
120
|
+
|
|
121
|
+
## Tech Stack
|
|
122
|
+
|
|
123
|
+
- Vue 3
|
|
124
|
+
- TypeScript
|
|
125
|
+
- Hono
|
|
126
|
+
- Effect
|
|
127
|
+
- Commander.js
|
|
128
|
+
|
|
129
|
+
## Development
|
|
130
|
+
|
|
131
|
+
You can use Claude to execute the `/full-release` command to automatically update dependencies and push to npm.
|
package/dist-cli/cli.js
CHANGED
|
@@ -77,7 +77,7 @@ import { computed, reactive, watch } from "vue";
|
|
|
77
77
|
// package.json
|
|
78
78
|
var package_default = {
|
|
79
79
|
name: "oceanpress",
|
|
80
|
-
version: "1.0.
|
|
80
|
+
version: "1.0.14",
|
|
81
81
|
type: "module",
|
|
82
82
|
description: "\u4ECE\u601D\u6E90\u7B14\u8BB0\u672C\u751F\u6210\u9759\u6001\u7AD9\u70B9\u7684\u5DE5\u5177",
|
|
83
83
|
author: "siyuan-note",
|
|
@@ -271,11 +271,7 @@ var defaultConfig = {
|
|
|
271
271
|
/** Markdown 镜像导出配置 */
|
|
272
272
|
markdownMirror: {
|
|
273
273
|
enable: false,
|
|
274
|
-
outputDir: "",
|
|
275
274
|
includeAssets: false,
|
|
276
|
-
watchMode: false,
|
|
277
|
-
/** 定时同步间隔(毫秒) */
|
|
278
|
-
watchInterval: 6e4,
|
|
279
275
|
/** 是否移除头部和底部(侧边栏、导航、footer 等) */
|
|
280
276
|
removeTemplate: false
|
|
281
277
|
},
|
|
@@ -563,6 +559,7 @@ var MarkdownMirrorPlugin = class {
|
|
|
563
559
|
if (otherConfig?.beforeFileTree) {
|
|
564
560
|
await otherConfig.beforeFileTree(tree, effectApi);
|
|
565
561
|
}
|
|
562
|
+
console.log("[MarkdownMirrorPlugin] config.markdownMirror?.enable:", config.markdownMirror?.enable);
|
|
566
563
|
if (config.markdownMirror?.enable) {
|
|
567
564
|
effectApi.log("\n=== \u5F00\u59CB Markdown \u955C\u50CF\u5BFC\u51FA ===");
|
|
568
565
|
try {
|
|
@@ -2865,7 +2862,9 @@ var OceanPress = class {
|
|
|
2865
2862
|
deployOceanPressServer_plugin(this.config)
|
|
2866
2863
|
);
|
|
2867
2864
|
}
|
|
2865
|
+
console.log("[OceanPress constructor] config.markdownMirror?.enable:", config.markdownMirror?.enable);
|
|
2868
2866
|
if (config.markdownMirror?.enable) {
|
|
2867
|
+
console.log("[OceanPress] \u6CE8\u518C MarkdownMirror \u63D2\u4EF6");
|
|
2869
2868
|
this.pluginCenter.registerPlugin(
|
|
2870
2869
|
new MarkdownMirrorPlugin(config.markdownMirror)
|
|
2871
2870
|
);
|