Skip to content

Commit

Permalink
update version and readme
Browse files Browse the repository at this point in the history
  • Loading branch information
shenjinglei committed Oct 27, 2023
1 parent 62726c1 commit da61504
Show file tree
Hide file tree
Showing 9 changed files with 96 additions and 29 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# CHANGE LOG

## 0.3.0/2023-10-28

- [v0.2.1 ... v0.3.0](https://github.com/shenjinglei/siyuan-plugin-graph-enhance/compare/v0.2.1...v0.3.0)
- Added a function that separates the graph.
- Adjusted the style of graphs.
- Fit the dark mode

## 0.2.1/2023-10-21

- [v0.2.0 ... v0.2.1](https://github.com/shenjinglei/siyuan-plugin-graph-enhance/compare/v0.2.0...v0.2.1)
- none

## 0.2.0/2023-10-20

- [v0.1.7 ... v0.2.0](https://github.com/shenjinglei/siyuan-plugin-graph-enhance/compare/v0.1.7...v0.2.0)
Expand Down
82 changes: 66 additions & 16 deletions README_zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
## 开始

启用本插件后,会在右上方添加一个侧边栏按钮,打开侧边栏后点击上方的功能按钮,会在侧边栏中绘制相应的关系图。
例如,在笔记【a】中引用了笔记【b】、【c】和【d】,思源笔记会绘制如下关系图:

![pic1](https://z1.ax1x.com/2023/10/20/piFpacQ.png)
例如,在笔记【a】中引用了笔记【b】、【c】和【d】,思源笔记的关系图如左图所示,本插件绘制的关系图如右图所示。

而本插件会绘制如下关系图,更突出一种层次关系:
![pic1](https://z1.ax1x.com/2023/10/20/piFpacQ.png) ![pic2](https://z1.ax1x.com/2023/10/20/piFpN9S.png)

![pic2](https://z1.ax1x.com/2023/10/20/piFpN9S.png)
本插件更突出层次关系。

## 功能说明

Expand All @@ -21,31 +20,81 @@

![pic3](https://z1.ax1x.com/2023/10/20/piFScyd.png)

绘制过程由一个起始点开始,即当前文档,在图中用红色标记;其他链接到的点用蓝色标记。
设置中可以调整布局方向、布局方式、节点个数限制等。
- 绘制过程由一个起始点开始,即当前文档,在图中用红色标记;其他链接到的点用蓝色标记。
- 设置中可以调整布局方向、布局方式、节点个数限制等。

### 起点/终点图

起点/终点图会从起点(即没有被其他笔记引用)或终点(即没有引用其他笔记)开始绘制旭日图。如下图所示。
起点/终点图会从起点(即没有被其他笔记引用)或终点(即没有引用其他笔记)开始绘制旭日图。

![](https://z1.ax1x.com/2023/10/20/piF9dPK.jpg)
假设起点图如下图所示,说明起始笔记有`A``B`两篇,其中`A`有子笔记`a1``a2`,其下分别还有子笔记`a11``a21`

不足三层的块会被合并入“其他”块中。
如果绘制后的图太密集或太稀疏,可以调整设置中的阈值。调高阈值可以减少显示的块数量。
![](https://z1.ax1x.com/2023/10/27/pieiS2R.png)

- 不足三层的块会被合并入“其他”块中。
- 如果绘制后的图太密集或太稀疏,可以调整设置中的阈值。调高阈值可以减少显示的块数量。

### 邻近图

从起始点开始,经过特定次链接可达的点所绘制的图。
设置中可以调整该次数。
- 从起始点开始,经过特定次链接可达的点所绘制的图。
- 设置中可以调整该次数。

### 纵横图

纵向图和横向图合并后的图。也是关系图增强的默认绘制方式。
- 纵向图和横向图合并后的图。也是关系图增强的默认绘制方式。

### 图分割

有时候当绘制图的节点过多,我们希望将图按某些条件分割时,可以按以下方式操作。

首先,如下所示生成的图。假设以“b”为起始点,正向链接的节点为`1`,中间的链接线为`0.5`,再远些的为`1.5`,`2`以此类推。反向链接指向的为负数如`-0.5`,`-1`

![](https://z1.ax1x.com/2023/10/27/pie9fL8.png)

分割时我们需要指定`起始点``分割位置`

#### 点分割

当我们想分割`c`,`c1`,`c2`点时,我们可以指定以`b,1`分割(也可以用`a,2`分割)。

分割后,从`b`起始的图如下,将不再绘制`c`,`c1`,`c2`之后的节点。

![](https://z1.ax1x.com/2023/10/27/pieCVeO.png)

`b`起始的图也不再绘制`c`,`c1`,`c2`之前的节点。

![](https://z1.ax1x.com/2023/10/27/pieCZwD.png)

而从`c`起始的图会将两部分的都绘制。

![](https://z1.ax1x.com/2023/10/27/pieCllt.png)

#### 边分割

当我们想分割`c-d`,`c1-d`,`c2-d`的边时,我们可以指定以`b,1.5`分割(也可以用`a,2.5`分割)。

分割后,从`b`起始的图如下,`c-d`,`c1-d`,`c2-d`的边不会绘制了。

![](https://z1.ax1x.com/2023/10/27/pieCT0O.png)

`e`起始的图如下,`c-d`,`c1-d`,`c2-d`的边也不会绘制了。

![](https://z1.ax1x.com/2023/10/27/pieCLhd.png)

`c`起始的图,将会绘制`c-d`的边。

![](https://z1.ax1x.com/2023/10/27/pieP9HS.png)

-`插件设置``图分割配置`中,可以指定分割,每个分割字符串一行。

![](https://z1.ax1x.com/2023/10/27/piePMEF.png)

- 起始于`分割点``分割边`上的图可以跨越分割,同时看到两边的图。

### 其他

点击节点可以跳转至对应笔记,可以当做另一种笔记目录。
设置中可以设置“跟随”当前文档,让笔记与图形联动更流畅。
- 点击节点可以跳转至对应笔记,可以当做另一种笔记目录。
- 设置中可以设置“跟随”当前文档,让笔记与图形联动更流畅。

### 一些实践

Expand All @@ -63,6 +112,7 @@
## 反馈

如果有问题、建议等可通过[github issue](https://github.com/shenjinglei/siyuan-plugin-graph-enhance/issues)反馈。

若无法访问也可以通过[gitee issue](https://gitee.com/shenjinglei/siyuan-plugin-graph-enhance/issues)反馈。

## 赞助
Expand All @@ -73,4 +123,4 @@

- 本插件使用了[Dagre](https://github.com/dagrejs/dagre)进行有向图布局计算
- 本插件使用了[Apache ECharts](https://echarts.apache.org/en/index.html)绘制图形
- [siyuan](https://github.com/siyuan-note/siyuan)
- 本项目为[siyuan](https://github.com/siyuan-note/siyuan)插件,已在思源集市上架。
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": "graph-enhance",
"author": "shenjinglei",
"url": "https://github.com/shenjinglei/siyuan-plugin-graph-enhance",
"version": "0.2.1",
"version": "0.3.0",
"minAppVersion": "2.10.6",
"backends": ["all"],
"frontends": ["all"],
Expand Down
Binary file modified preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion src/dock.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { enhancedGraph } from "./graph";
import { i18n, plugin, isMobile } from "./utils";
import { adaptHotkey, fetchSyncPost } from "siyuan";
import { getSetting } from "./settings";

import "./index.scss";
const DOCK_TYPE = "dock_tab";
Expand Down
5 changes: 4 additions & 1 deletion src/i18n/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,8 @@
"settingSinkThreshold": "Sink Graph Threshold",
"checkNeighborDepthErrorMsg": "Neighbor Graph Depth is not a number! Setting hasn't saved",
"checkSourceThresholdErrorMsg": "Source Graph Threshold is not a number! Setting hasn't saved",
"checkSinkThresholdErrorMsg": "Sink Graph Threshold is not a number! Setting hasn't saved"
"checkSinkThresholdErrorMsg": "Sink Graph Threshold is not a number! Setting hasn't saved",

"separationTitle": "graph separation configuration",
"pleaseInput": "please input"
}
5 changes: 4 additions & 1 deletion src/i18n/zh_CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,8 @@
"settingSinkThreshold": "终点图阈值",
"checkNeighborDepthErrorMsg": "邻近图深度不是数字!设置未保存",
"checkSourceThresholdErrorMsg": "起点图阈值不是数字!设置未保存",
"checkSinkThresholdErrorMsg": "起点图阈值不是数字!设置未保存"
"checkSinkThresholdErrorMsg": "起点图阈值不是数字!设置未保存",

"separationTitle": "图分割配置",
"pleaseInput": "请输入"
}
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default class GraphEnhancePlugin extends Plugin {
autoFollow: "false",
sourceThreshold: "3",
sinkThreshold: "3",
disconnection: "[]",
separation: "",
}, this.data[STORAGE_NAME])
);

Expand Down
16 changes: 8 additions & 8 deletions src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export function settingInit() {
autoFollow: autoFollowElement.value,
sourceThreshold: sourceThresholdElement.value,
sinkThreshold: sinkThresholdElement.value,
disconnection: disconnectionElement.value
separation: separationElement.value
});


Expand Down Expand Up @@ -164,15 +164,15 @@ export function settingInit() {
},
});

const disconnectionElement = document.createElement("textarea");
disconnectionElement.id = "disconnection";
disconnectionElement.placeholder = "请输入";
disconnectionElement.className = "b3-text-field fn__block";
const separationElement = document.createElement("textarea");
separationElement.id = "separation";
separationElement.placeholder = i18n.pleaseInput;
separationElement.className = "b3-text-field fn__block";
plugin.setting.addItem({
title: "切断链接",
title: i18n.separationTitle,
createActionElement: () => {
disconnectionElement.value = plugin.data[STORAGE_NAME].disconnection;
return disconnectionElement;
separationElement.value = plugin.data[STORAGE_NAME].separation;
return separationElement;
},
});
}

0 comments on commit da61504

Please sign in to comment.