Formatting Toolbar for selections

Update

  • :white_check_mark: Added support for custom buttons and marker/delimiters for third party libraries, for example for Copyable by @thepaperpilot
config.set("FormattingToolbar", {
    enabled = true,

 -- ... the rest of the config

 -- the example to add a formatting button for copyable library
    customButtons = {
        {
            name  = "Text: Copy Block",   -- unique, becomes the command name
            key   = "Copy",               -- tooltip text (optional, defaults to name)
            start = "[copy]",             -- starting marker delimiter
            stop  = "[/copy]",            -- "end" is a Lua reserved word, hence "stop"
            icon  = [[<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg>]],
            show  = true                  -- optional, defaults to true
        },
    }
})