created: 20260726051257984
modified: 20260726102329635
tags: 资料 🍀
title: tiddlywiki
type: text/vnd.tiddlywiki
! 新增一个语法高亮
增加一个 [[tiddlers/highlight-tiddlywiki.tid|$:/plugins/local/highlight-languages/tiddlywiki.js]] 文件,重启服务就可以了
点击展开文件内容
{{$:/plugins/local/highlight-languages/tiddlywiki.js}}
! 在侧边增加一个新的 tab
```tid
title: $:/plugins/local/sidebar/starred
type: text/vnd.tiddlywiki
tags: $:/tags/SideBar
caption: 🍀
list-after: $:/core/ui/SideBar/More
```
! 插件 - 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]]
点击展开文件内容
{{$:/plugins/local/copy-codeblock/copy-codeblock.js}}
! 资源文件管理
图片文件可以和条目文件分开保存,可以和 html 分开加载
资源文件可以放置在 files 文件夹中,通过 ./files/... 的方式引用
资源文件的上传下载,用 webdav 好了
增加索取所有文件的接口,写入到 tiddlers/files-list-api.tid 文件中
点击展开文件内容
{{files-list-api.tid}}
在 wiki 中获取文件列表
```tid
\procedure store-file-list()
<$action-setfield
$tiddler="$:/temp/files-list"
text=<>
type="application/json"
/>
\end
<$button>
<$action-sendmessage
$message="tm-http-request"
url="./api/files"
method="GET"
oncompletion=<>
/>
刷新文件列表
$button>
<$text text={{$:/temp/files-list}}/>
```