Skip to content

Commit

Permalink
misc
Browse files Browse the repository at this point in the history
  • Loading branch information
frostime committed Dec 11, 2024
1 parent 568d484 commit 66e64ee
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sy-query-view",
"version": "1.0.0-beta8",
"version": "1.0.0-beta9",
"type": "module",
"description": "This is a sample plugin based on vite and svelte for Siyuan (https://b3log.org/siyuan). Created with siyuan-plugin-cli v2.4.5.",
"repository": "https://github.com/frostime/sy-query-view",
Expand Down
2 changes: 1 addition & 1 deletion plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "sy-query-view",
"author": "frostime",
"url": "https://github.com/frostime/sy-query-view",
"version": "1.0.0-beta8",
"version": "1.0.0-beta9",
"minAppVersion": "3.1.14",
"backends": [
"windows",
Expand Down
4 changes: 2 additions & 2 deletions public/types.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**
* @name sy-query-view
* @author frostime
* @version 1.0.0-beta8
* @updated 2024-12-11T04:49:55.328Z
* @version 1.0.0-beta9
* @updated 2024-12-11T05:01:13.391Z
*/

declare module 'siyuan' {
Expand Down
15 changes: 14 additions & 1 deletion src/user-help/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createDocWithMd, removeDoc, request, setBlockAttrs, sql, updateBlock } from "@/api";
import { createDocWithMd, removeDoc, renameDoc, request, setBlockAttrs, sql, updateBlock } from "@/api";
import type QueryViewPlugin from "@/index";
import { openBlock } from "@/utils";
import { showMessage } from "siyuan";
Expand Down Expand Up @@ -37,6 +37,16 @@ const createReadmeText = async (plugin: QueryViewPlugin) => {

const response = await fetch(`/plugins/sy-query-view/${fname}`);
let readme = await response.text();

// let urlTemplate = `https://github.com/frostime/sy-query-view/blob/v${plugin.version}/assets/{{file}}?raw=true`;

// const regex = /!\[image\]\(assets\/([^)]+)\s*"([^"]+)?"\)/g;
// // Replace matched images with the desired syntax
// readme = readme.replace(regex, (match, filename, title) => {
// const fullUrl = urlTemplate.replace('{{file}}', filename.trim());
// return `![${title || 'image'}](${fullUrl})`;
// });

const AheadHint = i18n.user_help.ahead_hint.trim();
let ahead = AheadHint.replace('{{version}}', plugin.version);
readme = ahead + '\n' + OutlineCode + '\n\n' + readme;
Expand Down Expand Up @@ -99,6 +109,9 @@ const useUserReadme = async (plugin: QueryViewPlugin) => {
let newText = await createReadmeText(plugin);
await updateBlock('markdown', newText, targetDocId);
await setBlockAttrs(targetDocId, { [CUSTOM_USER_README_ATTR]: plugin.version });
const title = `${plugin.displayName}@${plugin.version} ` + i18n.src_userhelp_indexts.help_doc;
const doc = docs[0];
await renameDoc(doc.box, doc.path, title)
}

setTimeout(() => {
Expand Down

0 comments on commit 66e64ee

Please sign in to comment.