Skip to content

Create your own wrappings with optional key bindings for selected text, a set of useful defaults is also provided.

License

Notifications You must be signed in to change notification settings

qbosen/logseq-plugin-wrap

Repository files navigation

logseq-plugin-wrap

创建自定义文字包裹行为及快捷键,默认提供了一组实用的配置。

Create your own wrappings with optional key bindings for selected text, a set of useful defaults is also provided.

使用展示 (Usage)

demo

用户配置 (User configs)

{
  "disabled": false,
  "toolbar": true,
  "wrappings": [
    {
      "key": "wrap-cloze",
      "label": "Wrap with cloze",
      "binding": "mod+ctrl+c",
      "template": "{{cloze $^}}"
    },
    {
      "key": "wrap-red-hl",
      "label": "Wrap with red highlight",
      "binding": "mod+ctrl+r",
      "template": "[[#red]]==$^=="
    },
    {
      "key": "wrap-green-hl",
      "label": "Wrap with green highlight",
      "binding": "mod+ctrl+g",
      "template": "[[#green]]==$^=="
    },
    {
      "key": "wrap-blue-hl",
      "label": "Wrap with blue highlight",
      "binding": "mod+ctrl+b",
      "template": "[[#blue]]==$^=="
    },
    {
      "key": "wrap-yellow-hl",
      "label": "Wrap with yellow highlight",
      "binding": "mod+ctrl+y",
      "template": "[[#yellow]]==$^=="
    },
    {
      "key": "wrap-red-text",
      "label": "Wrap with red text",
      "binding": "",
      "template": "[[$red]]==$^=="
    },
    {
      "key": "wrap-green-text",
      "label": "Wrap with green text",
      "binding": "",
      "template": "[[$green]]==$^=="
    },
    {
      "key": "wrap-blue-text",
      "label": "Wrap with blue text",
      "binding": "",
      "template": "[[$blue]]==$^=="
    }
  ]
}

在 Logseq 的插件页面打开插件的配置后,有以下几项配置可供使用,请参照上方代码块进行设置(各项的默认值以体现在代码块中):

  • wrappings: 自定义的包裹行为都定义在这里。你可以扩展默认提供的行为,也可以移除或替换你不需要的默认行为。配置方法请参考上面的配置,keybinding不能出现重复。template是你要包裹的模板,里面的$^代表原本被选中的文字。

There are a couple of user settings available when you access the plugin settings from Logseq's plugins page. Please refer to the source block above (Default values are given in the source block).

  • wrappings: Your custom wrappings are defined here. You can extend default wrappings and/or replace/remove them. Please refer to the above configuration for how to define wrappings, key and binding should be unique, template defines how you want the selected text to be wrapped, $^ represents the selected text.

About

Create your own wrappings with optional key bindings for selected text, a set of useful defaults is also provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published