File tree Expand file tree Collapse file tree 3 files changed +8
-7
lines changed Expand file tree Collapse file tree 3 files changed +8
-7
lines changed Original file line number Diff line number Diff line change 3
3
- [ ] 支持数字编号
4
4
- [ ] 思路:添加一个命令,把当前文档的脚注转化为数字编号,考虑到思源的动态加载机制,应该是把当前文档导出kramdown文本,直接对kramdown进行处理。注意,导出kramdown需要用span样式(https://github.com/siyuan-note/siyuan/issues/13183)
5
5
1 . 首先先用正则搜索形如` <sup>((20241118190709-lx2usll "注"))</sup>{: style="--memo: 1"} ` 的块引,根据搜索,获取每个被引用的块id,考虑到可能会存在重复,只考虑这个id在整个文档第一次出现的顺序进行排序。排序后将块引中的` "注" ` 改为单引号包裹的对应块id的序号(思源笔记kramdown语法单引号代表动态锚文本)。
6
- 2 . 然后用设置属性api,添加命名,并把脚注引用变为动态锚文本 (块引由原来的s改为d),应该就可以实现了
6
+ 2 . 把脚注引用变为动态锚文本 (块引由原来的s改为d)
7
7
- [ ] 需要改进下如何做到选择同一文本,如果已经有脚注了,脚注块引应该放在最后,而不是放在最前
8
- - [ ] 用protyle.insert 插入块引
8
+ - [ ] 用protyle.insert 插入块引(不需要了,因为插入块引不需要有选中文本,用setInlineMark就行)
9
9
- [ ] 需要获取range的位置,然后根据位置判断是否有脚注,如果有脚注,就插入在脚注后面
10
10
- [ ] 不过也可以选中全部文本,插入脚注,不过获取的selection文本需要排除已经添加的脚注,这样更简单一点,也更加自由,只需要对selection文本进行处理,这个应该是好处理的
11
+ - [ ] 如果选中的文本末尾不包含脚注,则应该新增的脚注要放在所有脚注后面,如果选中的文本末尾包含脚注,就直接放到当前选中文本的后面,这样就非常自由
11
12
- [ ] 优化导出到微信公众号
12
13
- [ ] 去除脚注块引锚文本,只保留导出
13
14
- [ ] 不导出脚注内容,只显示思源的脚注
Original file line number Diff line number Diff line change 44
44

45
45
46
46
47
+ 支持对同一个文本进行多次备注
48
+
49
+ 
50
+
47
51
## 🙏致谢
48
52
49
53
* [https://github.com/zxhd863943427/siyuan-plugin-memo](https://github.com/zxhd863943427/siyuan-plugin-memo):基于该插件进行改进,添加了更多功能和配置项
Original file line number Diff line number Diff line change @@ -328,12 +328,8 @@ export default class PluginMemo extends Plugin {
328
328
let range = protyle . toolbar . range ;
329
329
330
330
// 将range的起始点和结束点都移动到选中文本的末尾
331
- const str = ""
332
- const textNode = document . createTextNode ( str ) ;
333
331
range . collapse ( false ) ;
334
- protyle . toolbar . range . insertNode ( textNode ) ;
335
- protyle . toolbar . range . setEndAfter ( textNode ) ;
336
- protyle . toolbar . range . setStartBefore ( textNode ) ;
332
+
337
333
338
334
// 添加块引,同时添加上标样式
339
335
protyle . toolbar . setInlineMark ( protyle , "clear" , "toolbar" ) ;
You can’t perform that action at this time.
0 commit comments