Skip to content

Commit

Permalink
docs: update documentations (#28)
Browse files Browse the repository at this point in the history
1. 修改文档标题
2. 移除首页,直接显示文档
3. 支持图片放大
4. 升级 vitepress

```release-note
None 
```
  • Loading branch information
ruibaby committed Sep 5, 2023
1 parent d61725d commit 34ac858
Show file tree
Hide file tree
Showing 9 changed files with 201 additions and 164 deletions.
7 changes: 5 additions & 2 deletions docs/.vitepress/config.ts → docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { defineConfig } from "vitepress";
// https://vitepress.dev/reference/site-config
export default defineConfig({
lang: "zh-CN",
title: "HaloPluginMigrate",
title: "Halo 迁移插件",
description: "多平台迁移至 Halo 2.x 的迁移插件使用文档",
head: [["link", { rel: "icon", href: "/halo-favicon.webp" }]],
lastUpdated: true,
Expand All @@ -20,7 +20,10 @@ export default defineConfig({

sidebar: [
{
text: "Provider",
items: [{ text: "介绍", link: "/" }],
},
{
text: "迁移",
items: [
{ text: "Halo 1.x", link: "/provider/halo" },
{ text: "WordPress", link: "/provider/wordpress" },
Expand Down
13 changes: 13 additions & 0 deletions docs/.vitepress/theme/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
p > img {
border-radius: 0.4rem;
box-shadow: 2px 2px 0.4rem 2px rgba(0, 0, 0, 0.3);
overflow: hidden;
}

.medium-zoom-overlay {
z-index: 20;
}

.medium-zoom-image {
z-index: 21;
}
23 changes: 23 additions & 0 deletions docs/.vitepress/theme/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import DefaultTheme from "vitepress/theme";
import { onMounted, watch, nextTick } from "vue";
import "./custom.css";
import mediumZoom from "medium-zoom";
import { useRoute } from "vitepress/client";

export default {
...DefaultTheme,

setup() {
const route = useRoute();
const initZoom = () => {
mediumZoom("[data-zoomable]", { background: "var(--vp-c-bg)" });
};
onMounted(() => {
initZoom();
});
watch(
() => route.path,
() => nextTick(() => initZoom())
);
},
};
58 changes: 29 additions & 29 deletions docs/extend/provider.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,38 +14,38 @@
2. 在新建的文件夹中,创建一个 `vue` 文件,用于展示导入数据的界面以及处理、转换导入的数据,如 `HaloMigrateDataParser.vue` 文件。
3. 编写 `HaloMigrateDataParser.vue` 文件,此 vue 模板接收一个 [MigrateData](#migratedata) 类型的数据,用户最终解析完成导入数据后,需要更新此数据以进行下一步操作。后续操作将基于 **MigrateData** 进行。例如

```ts
defineProps<{
data: MigrateData;
}>();

const emit = defineEmits<{
(event: "update:data", value: MigrateData): void;
}>();

/**
* 必要操作:处理数据处理完成之后,触发 update:data 事件来更新 data。
*/
const handleDataChange = (data: MigrateData) => {
emit("update:data", data);
};
```
```ts
defineProps<{
data: MigrateData;
}>();

const emit = defineEmits<{
(event: "update:data", value: MigrateData): void;
}>();

/**
* 必要操作:处理数据处理完成之后,触发 update:data 事件来更新 data。
*/
const handleDataChange = (data: MigrateData) => {
emit("update:data", data);
};
```

4.**console/src/modules** 目录下的 **index.ts** 文件中,为 `providerItems` 新增一个 [Provider](#provider) 对象,例如

```json
{
name: "Halo",
icon: "https://halo.run/logo",
description: "Halo 1.5 / 1.6 数据迁移",
importComponent: defineAsyncComponent(
() => import("./halo/HaloMigrateDataParser.vue") // 扩展文件
),
options: {
attachmentFolderPath: "migrate-from-1.x", // 附件迁移文件夹
},
},
```
```json
{
name: "Halo",
icon: "https://halo.run/logo",
description: "Halo 1.5 / 1.6 数据迁移",
importComponent: defineAsyncComponent(
() => import("./halo/HaloMigrateDataParser.vue") // 扩展文件
),
options: {
attachmentFolderPath: "migrate-from-1.x", // 附件迁移文件夹
}
}
```

## MigrateData

Expand Down
40 changes: 20 additions & 20 deletions docs/extend/steps.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,29 @@

1.`console/src/view/MigrateView.vue` 文件中,找到 **stepItems** 属性,为其新增 [Step](#step) 字段,以 设置附件存储策略 为例如下所示:

```ts
{
key: "attachmentPolicy", // step item slot
name: "设置附件存储策略", // 步骤名称,将会展示在步骤条上
next: { // 下一步按钮设置
disabled: computed(() => { // 是否禁止下一步
return policyMap.value.size === 0;
}),
disabledMessage: "未设置附件存储策略", // 无法进行下一步时,出现的提示
},
visible: computed(() => { // 在步骤条中展示当前步骤的条件
return migrateData.value?.attachments != undefined;
}),
}
```
```ts
{
key: "attachmentPolicy", // step item slot
name: "设置附件存储策略", // 步骤名称,将会展示在步骤条上
next: { // 下一步按钮设置
disabled: computed(() => { // 是否禁止下一步
return policyMap.value.size === 0;
}),
disabledMessage: "未设置附件存储策略", // 无法进行下一步时,出现的提示
},
visible: computed(() => { // 在步骤条中展示当前步骤的条件
return migrateData.value ? .attachments != undefined;
}),
}
```
2. 设置完上述步骤属性之后,还需要增加目标步骤的界面,在 **MigrateView.vue** 文件中,找到 `Steps` 组件,新建例如 attachmentPolicy 的 slot content,如下所示
```html
<template #attachmentPolicy>
<div>...</div>
</template>
```
```vue
<template #attachmentPolicy>
<div>...</div>
</template>
```
在其中编写页面模板及代码逻辑即可。
Expand Down
121 changes: 60 additions & 61 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,61 +1,60 @@
---
# https://vitepress.dev/reference/default-theme-home-page
layout: home

hero:
name: "迁移插件使用文档"
tagline: "Halo 官方迁移插件,支持从 Halo 1.x, WordPress, RSS 等多种导入数据至 Halo 中。"
actions:
- theme: brand
text: 快速开始
link: /provider/halo
- theme: alt
text: 在 Github 上查看
link: https://github.com/halo-sigs/plugin-migrate
---

<script setup>
import { VPTeamMembers } from 'vitepress/theme'

const members = [
{
avatar: 'https://www.github.com/ruibaby.png',
name: 'Ryan Wang',
title: 'Creator',
org: 'Halo-dev',
orgLink: 'https://github.com/halo-dev',
links: [
{ icon: 'github', link: 'https://github.com/ruibaby' },
]
},
{
avatar: 'https://www.github.com/lilgg.png',
name: 'Takagi',
title: 'Developer',
org: 'Halo-dev',
orgLink: 'https://github.com/halo-dev',
links: [
{ icon: 'github', link: 'https://github.com/lilgg' },
]
},
{
avatar: 'https://www.github.com/guqing.png',
name: 'guqing',
title: 'Developer',
org: 'Halo-dev',
orgLink: 'https://github.com/halo-dev',
links: [
{ icon: 'github', link: 'https://github.com/guqing' },
]
},
]
</script>

<VPTeamMembers size="small" :members="members" />

<style>
:root {
--vp-home-hero-name-color: transparent;
--vp-home-hero-name-background: -webkit-linear-gradient(120deg, #bd34fe, #41d1ff);
}
</style>
# plugin-migrate

支持多种平台的数据迁移,目前已支持:

1. Halo 1.5 / 1.6
2. WordPress
3. RSS / Atom 订阅链接

## 使用方式

1. 下载,目前提供以下两个下载方式:
- GitHub Releases:访问 [Releases](https://github.com/halo-sigs/plugin-migrate/releases) 下载 Assets 中的 JAR 文件。
- Halo 应用市场:<https://halo.run/store/apps/app-TlUBt>
2. 安装,插件安装和更新方式可参考:<https://docs.halo.run/user-guide/plugins>
3. 启动插件之后,即可在 Console 的左侧菜单栏看到**迁移**的菜单。

## 开发环境

```bash
git clone [email protected]:halo-sigs/plugin-migrate.git

# 或者当你 fork 之后

git clone [email protected]:{your_github_id}/plugin-migrate.git
```

```bash
cd path/to/plugin-migrate
```

```bash
# macOS / Linux
./gradlew pnpmInstall

# Windows
./gradlew.bat pnpmInstall
```

```bash
# macOS / Linux
./gradlew build

# Windows
./gradlew.bat build
```

修改 Halo 配置文件:

```yaml
halo:
plugin:
runtime-mode: development
classes-directories:
- "build/classes"
- "build/resources"
lib-directories:
- "libs"
fixedPluginPath:
- "/path/to/plugin-migrate"
```
10 changes: 6 additions & 4 deletions docs/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
{
"scripts": {
"docs:dev": "vitepress dev ",
"docs:build": "vitepress build ",
"docs:preview": "vitepress preview "
"docs:dev": "vitepress dev",
"docs:build": "vitepress build",
"docs:preview": "vitepress preview"
},
"dependencies": {
"vitepress": "1.0.0-beta.7"
"medium-zoom": "^1.0.8",
"vitepress": "1.0.0-rc.10",
"vue": "^3.3.4"
}
}
Loading

0 comments on commit 34ac858

Please sign in to comment.