You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@answer.apache.org by ro...@apache.org on 2024/09/19 07:02:45 UTC

(incubator-answer-plugins) branch main updated: refactor(highlight): Add theme_list.go for code highlighting (#224)

This is an automated email from the ASF dual-hosted git repository.

robin0716 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-answer-plugins.git


The following commit(s) were added to refs/heads/main by this push:
     new 7b5ce66  refactor(highlight): Add theme_list.go for code highlighting (#224)
7b5ce66 is described below

commit 7b5ce667ba6be40bea8a52dfeff39d48d27d2846
Author: robin <ro...@rnode.me>
AuthorDate: Thu Sep 19 15:02:41 2024 +0800

    refactor(highlight): Add theme_list.go for code highlighting (#224)
    
    Co-authored-by: kumfo <ku...@sifou.com>
    Co-authored-by: LinkinStars <li...@foxmail.com>
    Co-authored-by: LinkinStars <Li...@users.noreply.github.com>
    Co-authored-by: kumfo <ku...@users.noreply.github.com>
    Co-authored-by: sy-records <52...@qq52o.cn>
    Co-authored-by: robinv8 <ro...@users.noreply.github.com>
---
 .github/workflows/sync-info.yml             |   6 +-
 plugins_desc.json                           | 266 +++++++++++++---------------
 render-markdown-codehighlight/info.yaml     |   2 +-
 render-markdown-codehighlight/package.json  |   2 +-
 render-markdown-codehighlight/theme_list.go |  62 +++++++
 script/sync-info.sh                         |  13 +-
 6 files changed, 205 insertions(+), 146 deletions(-)

diff --git a/.github/workflows/sync-info.yml b/.github/workflows/sync-info.yml
index 61fb233..790ceec 100644
--- a/.github/workflows/sync-info.yml
+++ b/.github/workflows/sync-info.yml
@@ -18,9 +18,9 @@
 name: Sync info
 on:
   pull_request:
-    branches: [main]
+    branches: [dev]
   push:
-    branches: [main]
+    branches: [dev]
 
 jobs:
   build:
@@ -40,6 +40,6 @@ jobs:
           title: "chore: Sync Plugin Info"
           body: "Sync Plugin Info"
           branch: "chore/sync-info"
-          base: "main"
+          base: "dev"
           
   
\ No newline at end of file
diff --git a/plugins_desc.json b/plugins_desc.json
index d0f2047..1961cf9 100644
--- a/plugins_desc.json
+++ b/plugins_desc.json
@@ -1,236 +1,226 @@
 {
-  "en_US": [
+  "zh_CN": [
     {
-      "name": "Redis Cache",
-      "desc": "Use Redis as cache",
+      "name": "Redis缓存",
+      "desc": "使用Redis作为缓存",
       "link": "https://github.com/apache/incubator-answer-plugins/tree/main/cache-redis"
     },
     {
-      "name": "Formula Editor",
-      "desc": "Render formula in editor",
-      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/editor-formula"
-    },
-    {
-      "name": "Basic Captcha",
-      "desc": "Default graphic verification code",
+      "name": "基础验证码",
+      "desc": "默认图形验证码",
       "link": "https://github.com/apache/incubator-answer-plugins/tree/main/captcha-basic"
     },
     {
-      "name": "Elasticsearch Engine",
-      "desc": "Use Elasticsearch as search engine",
-      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/search-elasticsearch"
+      "name": "Google reCAPTCHA v2",
+      "desc": "Google reCAPTCHA v2 插件",
+      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/captcha-google-v2"
     },
     {
-      "name": "GitHub Connector",
-      "desc": "Connect to GitHub for third-party login",
-      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/connector-github"
+      "name": "阿里云CDN",
+      "desc": "通过阿里云CDN提升静态资源加速",
+      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/cdn-aliyun"
     },
     {
-      "name": "Google Connector",
-      "desc": "Connect to Google for third-party login",
-      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/connector-google"
+      "name": "Amazon CloudFront",
+      "desc": "通过AWS CDN提升静态资源加速",
+      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/cdn-s3"
     },
     {
-      "name": "Dingtalk Connector",
-      "desc": "Connect to Dingtalk for third-party login",
-      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/connector-dingtalk"
+      "name": "Apache 连接器",
+      "desc": "用于接入 Apache Oauth",
+      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/connector-apache"
     },
     {
-      "name": "Aliyun CDN",
-      "desc": "Speed up your website and enjoy greatly improved loading times around the world.",
-      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/cdn-aliyun"
+      "name": "通用连接器",
+      "desc": "适用于各种 OAuth 登录的通用插件",
+      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/connector-basic"
     },
     {
-      "name": "Aliyun OSS storage",
-      "desc": "Upload files to AliCloud OSS storage",
-      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/storage-aliyunoss"
+      "name": "钉钉连接器",
+      "desc": "用于接入钉钉第三方登录",
+      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/connector-dingtalk"
     },
     {
-      "name": "OAuth2 Basic",
-      "desc": "Generic OAuth2 Plugin",
-      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/connector-basic"
+      "name": "Google 连接器",
+      "desc": "用于接入 Google 第三方登录",
+      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/connector-google"
     },
     {
-      "name": "S3 storage",
-      "desc": "Upload files to S3 storage",
-      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/storage-s3"
+      "name": "图表编辑器",
+      "desc": "在编辑器中渲染图表",
+      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/editor-chart"
     },
     {
-      "name": "Amazon CloudFront",
-      "desc": "Speed up your website and enjoy greatly improved loading times around the world.",
-      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/cdn-s3"
+      "name": "公式编辑器",
+      "desc": "在编辑器中渲染公式",
+      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/editor-formula"
     },
     {
-      "name": "Embed",
-      "desc": "Embed content from other sites",
+      "name": "内容嵌入",
+      "desc": "在内容中嵌入其他网站",
       "link": "https://github.com/apache/incubator-answer-plugins/tree/main/embed-basic"
     },
     {
-      "name": "MeiliSearch",
-      "desc": "MeiliSearch is a powerful, fast, open-source, easy to use and deploy search engine.",
-      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/search-meilisearch"
+      "name": "Slack 通知",
+      "desc": "发送通知到 Slack",
+      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/notification-slack"
     },
     {
-      "name": "Google reCAPTCHA v2",
-      "desc": "Google reCAPTCHA v2 plugin",
-      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/captcha-google-v2"
+      "name": "代码高亮",
+      "desc": "高亮显示 Markdown 内容中的代码块",
+      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/render-markdown-codehighlight"
     },
     {
-      "name": "Chart Editor",
-      "desc": "Render chart in editor",
-      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/editor-chart"
+      "name": "Akismet Anti-Spam",
+      "desc": "Akismet Anti-Spam is used to check the content of posts and comments against the Akismet web service to see if they look like spam.",
+      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/reviewer-akismet"
     },
     {
-      "name": "WeCom",
-      "desc": "Get user info from WeCom and sync to User Center",
-      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/user-center-wecom"
+      "name": "基础审核插件",
+      "desc": "基础的通用审核插件",
+      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/reviewer-basic"
     },
     {
-      "name": "Code Highlight",
-      "desc": "Highlight code blocks in Markdown content",
-      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/render-markdown-codehighlight"
+      "name": "Algolia 搜索",
+      "desc": "使用 Algolia 作为搜索引擎.",
+      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/search-algolia"
     },
     {
-      "name": "Review Basic",
-      "desc": "Generic review rule plugin",
-      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/reviewer-basic"
+      "name": "Elasticsearch 引擎",
+      "desc": "使用 Elasticsearch 作为搜索引擎",
+      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/search-elasticsearch"
     },
     {
-      "name": "Slack Notification",
-      "desc": "Send notifications to Slack",
-      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/notification-slack"
+      "name": "MeiliSearch",
+      "desc": "MeiliSearch 是一个强大、快速、开源、易于使用和部署的搜索引擎。",
+      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/search-meilisearch"
     },
     {
-      "name": "Algolia Search",
-      "desc": "Use Algolia as a search engine.",
-      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/search-algolia"
+      "name": "阿里云OSS存储",
+      "desc": "上传文件到阿里云OSS存储",
+      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/storage-aliyunoss"
     },
     {
-      "name": "Akismet Anti-Spam",
-      "desc": "Akismet Anti-Spam is used to check the content of posts and comments against the Akismet web service to see if they look like spam.",
-      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/reviewer-akismet"
+      "name": "S3 存储",
+      "desc": "上传文件到S3存储",
+      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/storage-s3"
     },
     {
-      "name": "Apache Connector",
-      "desc": "Connect to Apache Oauth",
-      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/connector-apache"
+      "name": "企业微信",
+      "desc": "从企业微信获取用户信息并同步到用户中心",
+      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/user-center-wecom"
     }
   ],
-  "zh_CN": [
+  "en_US": [
     {
-      "name": "Redis缓存",
-      "desc": "使用Redis作为缓存",
+      "name": "Redis Cache",
+      "desc": "Use Redis as cache",
       "link": "https://github.com/apache/incubator-answer-plugins/tree/main/cache-redis"
     },
     {
-      "name": "公式编辑器",
-      "desc": "在编辑器中渲染公式",
-      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/editor-formula"
-    },
-    {
-      "name": "基础验证码",
-      "desc": "默认图形验证码",
+      "name": "Basic Captcha",
+      "desc": "Default graphic verification code",
       "link": "https://github.com/apache/incubator-answer-plugins/tree/main/captcha-basic"
     },
     {
-      "name": "Elasticsearch 引擎",
-      "desc": "使用 Elasticsearch 作为搜索引擎",
-      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/search-elasticsearch"
+      "name": "Google reCAPTCHA v2",
+      "desc": "Google reCAPTCHA v2 plugin",
+      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/captcha-google-v2"
     },
     {
-      "name": "GitHub 连接器",
-      "desc": "用于接入 GitHub 第三方登录",
-      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/connector-github"
+      "name": "Aliyun CDN",
+      "desc": "Speed up your website and enjoy greatly improved loading times around the world.",
+      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/cdn-aliyun"
     },
     {
-      "name": "Google 连接器",
-      "desc": "用于接入 Google 第三方登录",
-      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/connector-google"
+      "name": "Amazon CloudFront",
+      "desc": "Speed up your website and enjoy greatly improved loading times around the world.",
+      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/cdn-s3"
     },
     {
-      "name": "钉钉连接器",
-      "desc": "用于接入钉钉第三方登录",
-      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/connector-dingtalk"
+      "name": "Apache Connector",
+      "desc": "Connect to Apache Oauth",
+      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/connector-apache"
     },
     {
-      "name": "阿里云CDN",
-      "desc": "通过阿里云CDN提升静态资源加速",
-      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/cdn-aliyun"
+      "name": "OAuth2 Basic",
+      "desc": "Generic OAuth2 Plugin",
+      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/connector-basic"
     },
     {
-      "name": "阿里云OSS存储",
-      "desc": "上传文件到阿里云OSS存储",
-      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/storage-aliyunoss"
+      "name": "Dingtalk Connector",
+      "desc": "Connect to Dingtalk for third-party login",
+      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/connector-dingtalk"
     },
     {
-      "name": "通用连接器",
-      "desc": "适用于各种 OAuth 登录的通用插件",
-      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/connector-basic"
+      "name": "Google Connector",
+      "desc": "Connect to Google for third-party login",
+      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/connector-google"
     },
     {
-      "name": "S3 存储",
-      "desc": "上传文件到S3存储",
-      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/storage-s3"
+      "name": "Chart Editor",
+      "desc": "Render chart in editor",
+      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/editor-chart"
     },
     {
-      "name": "Amazon CloudFront",
-      "desc": "通过AWS CDN提升静态资源加速",
-      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/cdn-s3"
+      "name": "Formula Editor",
+      "desc": "Render formula in editor",
+      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/editor-formula"
     },
     {
-      "name": "内容嵌入",
-      "desc": "在内容中嵌入其他网站",
+      "name": "Embed",
+      "desc": "Embed content from other sites",
       "link": "https://github.com/apache/incubator-answer-plugins/tree/main/embed-basic"
     },
     {
-      "name": "MeiliSearch",
-      "desc": "MeiliSearch 是一个强大、快速、开源、易于使用和部署的搜索引擎。",
-      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/search-meilisearch"
+      "name": "Slack Notification",
+      "desc": "Send notifications to Slack",
+      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/notification-slack"
     },
     {
-      "name": "Google reCAPTCHA v2",
-      "desc": "Google reCAPTCHA v2 插件",
-      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/captcha-google-v2"
+      "name": "Code Highlight",
+      "desc": "Highlight code blocks in Markdown content",
+      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/render-markdown-codehighlight"
     },
     {
-      "name": "图表编辑器",
-      "desc": "在编辑器中渲染图表",
-      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/editor-chart"
+      "name": "Akismet Anti-Spam",
+      "desc": "Akismet Anti-Spam is used to check the content of posts and comments against the Akismet web service to see if they look like spam.",
+      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/reviewer-akismet"
     },
     {
-      "name": "企业微信",
-      "desc": "从企业微信获取用户信息并同步到用户中心",
-      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/user-center-wecom"
+      "name": "Review Basic",
+      "desc": "Generic review rule plugin",
+      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/reviewer-basic"
     },
     {
-      "name": "代码高亮",
-      "desc": "高亮显示 Markdown 内容中的代码块",
-      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/render-markdown-codehighlight"
+      "name": "Algolia Search",
+      "desc": "Use Algolia as a search engine.",
+      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/search-algolia"
     },
     {
-      "name": "基础审核插件",
-      "desc": "基础的通用审核插件",
-      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/reviewer-basic"
+      "name": "Elasticsearch Engine",
+      "desc": "Use Elasticsearch as search engine",
+      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/search-elasticsearch"
     },
     {
-      "name": "Slack 通知",
-      "desc": "发送通知到 Slack",
-      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/notification-slack"
+      "name": "MeiliSearch",
+      "desc": "MeiliSearch is a powerful, fast, open-source, easy to use and deploy search engine.",
+      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/search-meilisearch"
     },
     {
-      "name": "Algolia 搜索",
-      "desc": "使用 Algolia 作为搜索引擎.",
-      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/search-algolia"
+      "name": "Aliyun OSS storage",
+      "desc": "Upload files to AliCloud OSS storage",
+      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/storage-aliyunoss"
     },
     {
-      "name": "Akismet Anti-Spam",
-      "desc": "Akismet Anti-Spam is used to check the content of posts and comments against the Akismet web service to see if they look like spam.",
-      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/reviewer-akismet"
+      "name": "S3 storage",
+      "desc": "Upload files to S3 storage",
+      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/storage-s3"
     },
     {
-      "name": "Apache 连接器",
-      "desc": "用于接入 Apache Oauth",
-      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/connector-apache"
+      "name": "WeCom",
+      "desc": "Get user info from WeCom and sync to User Center",
+      "link": "https://github.com/apache/incubator-answer-plugins/tree/main/user-center-wecom"
     }
   ]
 }
diff --git a/render-markdown-codehighlight/info.yaml b/render-markdown-codehighlight/info.yaml
index 9eae2bf..10cdb8f 100644
--- a/render-markdown-codehighlight/info.yaml
+++ b/render-markdown-codehighlight/info.yaml
@@ -17,6 +17,6 @@
 
 slug_name: render_markdown_codehighlight
 type: render
-version: 0.0.2
+version: 0.0.3
 author: Chen Jiaji, Zhu Xuanlyu
 link: https://github.com/apache/incubator-answer-plugins/tree/main/render-markdown-codehighlight
diff --git a/render-markdown-codehighlight/package.json b/render-markdown-codehighlight/package.json
index a99b490..147088a 100644
--- a/render-markdown-codehighlight/package.json
+++ b/render-markdown-codehighlight/package.json
@@ -1,6 +1,6 @@
 {
   "name": "render-markdown-codehighlight",
-  "version": "0.0.2",
+  "version": "0.0.3",
   "description": "",
   "type": "module",
   "files": [
diff --git a/render-markdown-codehighlight/theme_list.go b/render-markdown-codehighlight/theme_list.go
new file mode 100644
index 0000000..831b2f2
--- /dev/null
+++ b/render-markdown-codehighlight/theme_list.go
@@ -0,0 +1,62 @@
+
+package render_markdown_codehighlight
+
+var ThemeList = []string{
+"1c-light",
+  "a11y-all",
+  "agate-dark",
+  "an-dark",
+  "androidstudio-dark",
+  "arduino-light",
+  "arta-dark",
+  "ascetic-light",
+  "atom-all",
+  "brown-light",
+  "codepen-dark",
+  "color-light",
+  "dark-dark",
+  "default-light",
+  "devibeans-dark",
+  "docco-light",
+  "far-dark",
+  "felipec-dark",
+  "foundation-light",
+  "github-all",
+  "gml-dark",
+  "googlecode-light",
+  "gradient-all",
+  "grayscale-light",
+  "hybrid-dark",
+  "idea-light",
+  "intellij-light",
+  "ir-dark",
+  "isbl-all",
+  "kimbie-all",
+  "lightfair-light",
+  "lioshi-dark",
+  "magula-light",
+  "mono-light",
+  "monokai-dark",
+  "night-dark",
+  "nnfx-all",
+  "nord-dark",
+  "obsidian-dark",
+  "panda-all",
+  "paraiso-all",
+  "pojoaque-light",
+  "purebasic-light",
+  "qtcreator-all",
+  "rainbow-dark",
+  "routeros-light",
+  "school-light",
+  "shades-dark",
+  "srcery-dark",
+  "stackoverflow-all",
+  "sunburst-dark",
+  "tokyo-all",
+  "tomorrow-dark",
+  "vs-light",
+  "vs2015-dark",
+  "xcode-light",
+  "xt256-dark",
+}
diff --git a/script/sync-info.sh b/script/sync-info.sh
index 48cb109..aa36cc4 100755
--- a/script/sync-info.sh
+++ b/script/sync-info.sh
@@ -35,13 +35,20 @@ done
 
 echo "{}" >"$project_root/plugins_desc.json"
 
-for dir in $(find "$project_root" -type d); do
-    if [[ "$dir" == *node_modules* ]] || [[ "$dir" == *.git* ]] || [[ "$dir" == *.vscode* ]]; then
+plugins=()
+for dir in "$project_root"/*/; do
+    if [[ "$dir" =~ (node_modules|util|script|.git|.vscode) ]]; then
         continue
     fi
+    plugins+=($(basename "$dir"))
+done
 
+plugins=($(printf '%s\n' "${plugins[@]}" | sort))
+
+for plugin in "${plugins[@]}"; do
     slug_name=""
     link=""
+    dir="$project_root/$plugin"
     if [ -f "$dir/info.yaml" ]; then
         slug_name=$(yq '.slug_name' "$dir/info.yaml")
         link=$(yq '.link' "$dir/info.yaml")
@@ -60,7 +67,7 @@ for dir in $(find "$project_root" -type d); do
                     if [ "$name" == "null" ] || [ "$description" == "null" ]; then
                         continue
                     fi
-                   
+
                     if [ -f "$project_root/plugins_desc.json" ]; then
                         if [ "$(jq ".$file_name" "$project_root/plugins_desc.json")" != "null" ]; then
                             jq ".$file_name += [{\"name\": \"$name\", \"desc\": \"$description\", \"link\": \"$link\"}]" "$project_root/plugins_desc.json" >"$project_root/plugins_desc.json.tmp"