# 利用Alfred给文本段前面加序号

{% embed url="<https://v.douyin.com/rRoC4AR/>" %}

{% embed url="<https://www.bilibili.com/video/BV1UY4y157Sk/>" %}

我不是经常把 sublime 当记事本用吗

然后我还有个需求

就是我经常需要把这一段的文字

前面加上序号

然后我发现其实可以用 js

写一个特别简单的 Alfred 插件

使用的效果就是这样哈

大家看先多选这一列

然后呢调出Alfred，插件名

现在不是8行吗我就输入打开就可以了

然后可以加一点啊什么的

还有就是甚至哈我还可以加子项

比如说我第7项有3个子元素

那我就把它放过来

然后呢还是多选他

空格7点后边的话呢我还是 sequence 这样就可以了

然后这个插件怎么写呢

其实特别特别简单

就是用这个 keyword 的触发了一个 run script

但注意这里边这要选成 JavaScript

然后这里边写一个 js 的方法

最终返回这个生成好的序列就行了

然后注意哈

他通过这种方法生成的字符串

最终他总会多一个换行

所以呢我们需要用正则

把这个换行替换掉

这样就可以了


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://sunzsh.gitbook.io/xiaoshan.bug/li-yong-alfred-gei-wen-ben-duan-qian-mian-jia-xu-hao.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
