aboutsummaryrefslogtreecommitdiffstats
path: root/tiddlers/tiddlywiki.tid
blob: 9c209ee8009a41db4cd1022cfa4766ee27432c17 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
created: 20260726051257984
modified: 20260726102329635
tags: 资料 🍀
title: tiddlywiki
type: text/vnd.tiddlywiki

! 新增一个语法高亮

增加一个 [[tiddlers/highlight-tiddlywiki.tid|$:/plugins/local/highlight-languages/tiddlywiki.js]] 文件,重启服务就可以了

<details>
<summary>点击展开文件内容</summary>

{{$:/plugins/local/highlight-languages/tiddlywiki.js}}

</details>

! 在侧边增加一个新的 tab

```tid
title: $:/plugins/local/sidebar/starred
type: text/vnd.tiddlywiki
tags: $:/tags/SideBar
caption: 🍀
list-after: $:/core/ui/SideBar/More

<div class="tc-sidebar-tab-open">

<$list
  filter="[tag[🍀]!has[draft.of]sort[title]]"
  emptyMessage="还没有设置 🍀 标签的条目。"
>
<div class="tc-sidebar-tab-open-item">
<$link/>
</div>
</$list>

</div>
```

! 插件 - github-fork-ribbon

在页面角落显示一个类似 GitHub “Fork me” 的斜角丝带,并链接到指定网址

编辑 [[$:/github-ribbon]] 并添加标签 {{$:/tags/PageTemplate||$:/core/ui/TagTemplate}}

填写内容

```tid
<$transclude
  $tiddler="$:/plugins/tiddlywiki/github-fork-ribbon/template"
  position="right"
  url="https://github.com/你的账号/你的仓库"
  text="在 GitHub 查看"
  color="#24292f"
  top="30px"
  fixed="fixed"
/>
```

! 插件 - 代码复制

在代码块右上角展示一个复制按钮,插件内容保存在 [[tiddlers/copy-codeblock.tid|$:/plugins/local/copy-codeblock/copy-codeblock.js]]

<details>
<summary>点击展开文件内容</summary>

{{$:/plugins/local/copy-codeblock/copy-codeblock.js}}

</details>

! 资源文件管理

图片文件可以和条目文件分开保存,可以和 html 分开加载

资源文件可以放置在 files 文件夹中,通过 ./files/... 的方式引用

资源文件的上传下载,用 webdav 好了

增加索取所有文件的接口,写入到 tiddlers/files-list-api.tid 文件中

<details>
<summary>点击展开文件内容</summary>

{{files-list-api.tid}}

</details>

在 wiki 中获取文件列表

```tid
\procedure store-file-list()
<$action-setfield
  $tiddler="$:/temp/files-list"
  text=<<data>>
  type="application/json"
/>
\end

<$button>
  <$action-sendmessage
    $message="tm-http-request"
    url="./api/files"
    method="GET"
    oncompletion=<<store-file-list>>
  />
  刷新文件列表
</$button>

<pre><$text text={{$:/temp/files-list}}/></pre>
```