Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Wang <[email protected]>
  • Loading branch information
ruibaby committed Oct 19, 2024
1 parent 501e8c5 commit 2193050
Show file tree
Hide file tree
Showing 34 changed files with 3,277 additions and 859 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: CD

on:
release:
types:
- published

jobs:
cd:
uses: halo-sigs/reusable-workflows/.github/workflows/plugin-cd.yaml@v2
secrets:
halo-pat: ${{ secrets.HALO_PAT }}
permissions:
contents: write
with:
node-version: "20"
pnpm-version: "9"
app-id: app-SUvBR
ui-path: "ui"
10 changes: 0 additions & 10 deletions OWNERS

This file was deleted.

83 changes: 19 additions & 64 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,76 +1,31 @@
# plugin-starter
# Halo 内容格式助手

Halo 2.0 插件开发快速开始模板
Halo 添加内容格式转换和导出的功能

## 开发环境
**⚠️ 目前格式转换并不能完全保留原格式,部分语法可能在不同的编辑器中有不同的表现,建议谨慎使用。**

插件开发的详细文档请查阅:<https://docs.halo.run/developer-guide/plugin/introduction>
## 特性

所需环境:
- 支持 Markdown 和富文本格式的互转。
- 支持导出文章内容,支持转换为 Markdown 文件导出。

1. Java 17
2. Node 20
3. pnpm 9
4. Docker (可选)
## 使用方式

克隆项目:
1. 下载,目前提供以下两个下载方式:
- Halo 应用市场:<https://www.halo.run/store/apps/app-SUvBR>
- GitHub Releases:访问 [Releases](https://github.com/ruibaby/plugin-content-tools/releases) 下载 Assets 中的 JAR 文件。
2. 安装,插件安装和更新方式可参考:<https://docs.halo.run/user-guide/plugins>
3. 在文章管理页面中,点击文章的 `···` 按钮即可看到 **转换****导出** 的功能选项。
4. 也可以在文章编辑页面顶部的编辑器选择框中选择 **内容格式转换器** 进行转换。

```bash
git clone [email protected]:halo-sigs/plugin-starter.git
## 预览

# 或者当你 fork 之后
![](./images/plugin-content-tools-preview-1.png)

git clone [email protected]:{your_github_id}/plugin-starter.git
```
![](./images/plugin-content-tools-preview-2.png)

```bash
cd path/to/plugin-starter
```
![](./images/plugin-content-tools-preview-3.png)

### 运行方式 1(推荐)
![](./images/plugin-content-tools-preview-4.png)

> 此方式需要本地安装 Docker
```bash
# macOS / Linux
./gradlew pnpmInstall

# Windows
./gradlew.bat pnpmInstall
```

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

# Windows
./gradlew.bat haloServer
```

执行此命令后,会自动创建一个 Halo 的 Docker 容器并加载当前的插件,更多文档可查阅:<https://docs.halo.run/developer-guide/plugin/basics/devtools>

### 运行方式 2

> 此方式需要使用源码运行 Halo
编译插件:

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

# Windows
./gradlew.bat build
```

修改 Halo 配置文件:

```yaml
halo:
plugin:
runtime-mode: development
fixedPluginPath:
- "/path/to/plugin-starter"
```
最后重启 Halo 项目即可。
![](./images/plugin-content-tools-preview-5.png)
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
id "run.halo.plugin.devtools" version "0.2.0"
}

group 'run.halo.starter'
group 'cc.ryanc.contenttools'
sourceCompatibility = JavaVersion.VERSION_17

repositories {
Expand Down Expand Up @@ -53,4 +53,4 @@ build {

halo {
version = '2.20'
}
}
Binary file added images/plugin-content-tools-preview-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/plugin-content-tools-preview-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/plugin-content-tools-preview-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/plugin-content-tools-preview-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/plugin-content-tools-preview-5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 1 addition & 2 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@ pluginManagement {
gradlePluginPortal()
}
}
rootProject.name = 'plugin-starter'

rootProject.name = 'plugin-content-tools'
16 changes: 16 additions & 0 deletions src/main/java/cc/ryanc/contenttools/ContentToolsPlugin.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package cc.ryanc.contenttools;

import org.springframework.stereotype.Component;
import run.halo.app.plugin.BasePlugin;
import run.halo.app.plugin.PluginContext;

/**
* @author ryanwang
*/
@Component
public class ContentToolsPlugin extends BasePlugin {

public ContentToolsPlugin(PluginContext pluginContext) {
super(pluginContext);
}
}
31 changes: 0 additions & 31 deletions src/main/java/run/halo/starter/StarterPlugin.java

This file was deleted.

1 change: 1 addition & 0 deletions src/main/resources/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed src/main/resources/logo.png
Binary file not shown.
23 changes: 10 additions & 13 deletions src/main/resources/plugin.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
# Refer https://docs.halo.run/developer-guide/plugin/basics/manifest

apiVersion: plugin.halo.run/v1alpha1
kind: Plugin
metadata:
# The name defines how the plugin is invoked, A unique name
name: starter
name: content-tools
spec:
enabled: true
requires: ">=2.20.0"
author:
name: Halo
website: https://github.com/halo-dev
logo: logo.png
homepage: https://github.com/halo-dev/plugin-starter#readme
repo: https://github.com/halo-dev/plugin-starter
issues: https://github.com/halo-dev/plugin-starter/issues
displayName: "插件快速开始模板"
description: "这是一个插件快速开始模板"
name: Ryan Wang
website: https://github.com/ruibaby
logo: icon.svg
homepage: https://github.com/ruibaby/plugin-content-tools#readme
repo: https://github.com/ruibaby/plugin-content-tools
issues: https://github.com/ruibaby/plugin-content-tools/issues
displayName: "内容格式助手"
description: "支持文章内容格式转换和导出"
license:
- name: "GPL-3.0"
url: "https://github.com/halo-dev/plugin-starter/blob/main/LICENSE"
url: "https://github.com/ruibaby/plugin-content-tools/blob/main/LICENSE"
8 changes: 8 additions & 0 deletions ui/env.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
/// <reference types="vite/client" />
/// <reference types="unplugin-icons/types/vue" />

export {};

declare module "axios" {
export interface AxiosRequestConfig {
mute?: boolean;
}
}
56 changes: 34 additions & 22 deletions ui/package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"type": "module",
"scripts": {
"dev": "vite build --watch --mode=development",
"build": "run-p type-check \"build-only {@}\" --",
Expand All @@ -9,36 +10,47 @@
"prettier": "prettier --write src/"
},
"dependencies": {
"@halo-dev/api-client": "^2.17.0",
"@halo-dev/components": "^2.17.0",
"@halo-dev/console-shared": "^2.17.0",
"axios": "^1.7.2",
"canvas-confetti": "^1.9.3",
"vue": "^3.4.31"
"@halo-dev/api-client": "^2.20.0",
"@halo-dev/components": "^2.20.0",
"@halo-dev/console-shared": "^2.20.0",
"@vueuse/core": "^11.1.0",
"@vueuse/router": "^11.1.0",
"axios": "^1.7.7",
"gray-matter": "^4.0.3",
"js-yaml": "^4.1.0",
"markdown-it": "^14.1.0",
"markdown-it-anchor": "^9.2.0",
"turndown": "^7.2.0",
"vue": "^3.5.12"
},
"devDependencies": {
"@halo-dev/ui-plugin-bundler-kit": "^2.17.0",
"@iconify/json": "^2.2.224",
"@rushstack/eslint-patch": "^1.10.3",
"@halo-dev/ui-plugin-bundler-kit": "^2.20.0",
"@iconify/json": "^2.2.261",
"@rushstack/eslint-patch": "^1.10.4",
"@tsconfig/node20": "^20.1.4",
"@types/canvas-confetti": "^1.6.4",
"@types/js-yaml": "^4.0.9",
"@types/jsdom": "^21.1.7",
"@types/node": "^20.14.9",
"@vitejs/plugin-vue": "^5.0.5",
"@types/markdown-it": "^14.1.2",
"@types/node": "^20.16.12",
"@types/turndown": "^5.0.5",
"@vitejs/plugin-vue": "^5.1.4",
"@vue/eslint-config-prettier": "^9.0.0",
"@vue/eslint-config-typescript": "^13.0.0",
"@vue/test-utils": "^2.4.6",
"@vue/tsconfig": "^0.5.1",
"eslint": "^8.57.0",
"eslint-plugin-vue": "^9.26.0",
"jsdom": "^24.1.0",
"npm-run-all2": "^6.2.0",
"prettier": "^3.3.2",
"sass": "^1.77.6",
"typescript": "~5.5.3",
"unplugin-icons": "^0.19.0",
"vite": "^5.3.2",
"eslint": "^8.57.1",
"eslint-plugin-vue": "^9.29.0",
"jsdom": "^24.1.3",
"npm-run-all2": "^6.2.4",
"prettier": "^3.3.3",
"prettier-plugin-organize-imports": "^4.1.0",
"sass": "^1.80.3",
"typescript": "~5.5.4",
"unocss": "^0.63.4",
"unplugin-icons": "^0.19.3",
"vite": "^5.4.9",
"vite-plugin-node-polyfills": "^0.22.0",
"vitest": "^1.6.0",
"vue-tsc": "^2.0.24"
"vue-tsc": "^2.1.6"
}
}
Loading

0 comments on commit 2193050

Please sign in to comment.