Quantcast
Channel: 簡睿隨筆
Viewing all articles
Browse latest Browse all 897

[Obs#35] Buttons外掛開啟筆記自動化操作契機⁉️

$
0
0

語法

button語法

    ```button
    name required
    type required
    action required
    color optional
    class optional
    id optional
    replace optional
    remove optional
    ```

  • 第一行必須是name (筆記裡唯一名稱)
```button
name 瀏覽簡睿隨筆
type link
action https://google.com
remove false
```

type類型

  1. command
  2. link
  3. template
  4. calculate

選項

argument description options example
name required: the name of the button any string My Button
type required run a command or open a url command, link, template, calculate command
action required depending on button type this will be a command, link, template, or equation Toggle Pin or https://obsidian.md or My Template or 1+2 Toggle Pin
color optional: arg to change color of the button blue, green, red, purple. yellow blue
class optional: add a class to the button for more customized styling. Adding a custom class will remove default classes(全部小寫) a string representing your custom class button-default, button-shine
id optional: add a custom id to the button for styling a string representing your custom id myId
remove optional: if true removes button after command runs true true
replace optional: specify a section header above the button and it will remove content from the section (and replace if used with prepend template)(replace true要在最後一行) The section header directly above the button ## Replace this Section| undefined undefined undefined undefined undefined

按鈕範例

1. 命令按鈕

```button
name 匯出 PDF
type command
action 匯出 PDF
remove false
```

```button
name 釘選切換
type command
action 釘選切換
remove false
```

```button
name 切換焦點到右側面板
type command
action 切換焦點到右側面板
remove false
```

2. 連結按鈕

```button
name 瀏覽簡睿隨筆
type link
action http://jdev.tw/blog
```
```button
name 開啟新建立newnote1
type link
action obsidian://open?vault=MOC&file=newnote1#^top
```

3. 樣板按鈕

樣板按鈕
1. prepend template: 在按鈕前面插入指定樣板之內容
2. append template: 在按鈕後面插入指定樣板之內容
2. note(檔名路徑) template: 用指定的樣板建立新筆記到指定位置
4. 使用Templater外掛要勾選【Trigger Templater on new file creation】


```button
name 在按鈕前面插入test-loop樣板
type prepend template
action test-loop
```

```button
name 在按鈕後面插入test-loop樣板
type append template
action test-loop
```

```button
name 用test-loop樣板建立新筆記
type note(/newnote1) template
action test-loop
```

4. 運算按鈕

```button
name Add 1+2
type calculate
action 1+2
```

Result: 3

$行號取值:全形冒號後要有空白

商品名稱:iPad Pro
商品單價: NT$ 24000
購買數量: 3

```button
name iPad購買金額
type calculate
action $204*$205
```
Result: 72000

相關連結

教學影片

##您可能也會有興趣的類似文章


Viewing all articles
Browse latest Browse all 897

Trending Articles