Skip to content

Commit

Permalink
upgrade#0.7.2 voicenotes 同步时控制换行是否新建块
Browse files Browse the repository at this point in the history
  • Loading branch information
hqweay committed Feb 7, 2025
1 parent 1345c6d commit ea8c36d
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "siyuan-hqweay-go",
"version": "0.7.1",
"version": "0.7.2",
"type": "module",
"description": "恐龙工具箱",
"repository": "",
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": "siyuan-hqweay-go",
"author": "养恐龙",
"url": "https://github.com/hqweay/siyuan-hqweay-go",
"version": "0.7.1",
"version": "0.7.2",
"minAppVersion": "3.0.0",
"backends": [
"windows",
Expand Down
7 changes: 7 additions & 0 deletions src/setting.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,13 @@ https://shibe.online/api/shibes?count=1`,
key: "formatContent",
value: settings.getBySpace("voiceNotesConfig", "formatContent"),
},
{
type: "checkbox",
title: "换行是否新建块",
description: "否则当作行内换行处理",
key: "newLineNewBlock",
value: settings.getBySpace("voiceNotesConfig", "newLineNewBlock"),
},
// {
// type: "textinput",
// title: "时间格式",
Expand Down
1 change: 1 addition & 0 deletions src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ https://shibe.online/api/shibes?count=1`,
// frontmatterTemplate: `duration: {{duration}}
// created_at: {{created_at}}
// updated_at: {{updated_at}}`,
newLineNewBlock: true,
noteTemplate: `{% if summary %}
## Summary
Expand Down
17 changes: 10 additions & 7 deletions src/siyuan-voicenotes-sync/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,13 +306,16 @@ export default class VoiceNotesPlugin extends AddIconThenClick {
};

// 渲染模板
let note = jinja
.render(
settings.getBySpace("voiceNotesConfig", "noteTemplate"),
context
)
.replace(/\n{3,}/g, "\n\n");
note = convertHtmlToMarkdown(note);
let note = jinja.render(
settings.getBySpace("voiceNotesConfig", "noteTemplate"),
context
);

if (settings.getBySpace("voiceNotesConfig", "newLineNewBlock")) {
note = convertHtmlToMarkdown(note).replace(/\n+/g, "\n\n");
} else {
note = convertHtmlToMarkdown(note).replace(/\n{3,}/g, "\n\n");
}

if (settings.getBySpace("voiceNotesConfig", "formatContent")) {
// console.log("0" + note);
Expand Down

0 comments on commit ea8c36d

Please sign in to comment.