shorten markdown links to pasted images

This commit is contained in:
Rene Schallner
2021-11-26 05:30:11 +01:00
parent ea44fc04fc
commit 723a2d25ef
3 changed files with 6 additions and 6 deletions

View File

@@ -104,7 +104,7 @@ require('telekasten').setup({
-- image link style
-- wiki: ![[image name]]
-- markdown: ![image name](image_subdir/xxxxx.png)
-- markdown: ![](image_subdir/xxxxx.png)
image_link_style = "wiki",
-- integrate with calendar-vim
@@ -129,7 +129,7 @@ END
| `image_subdir` | sub-directory where pasted images should go | img |
| | set to nil if pasted images shouldn't go into a special subdir | img |
| `image_link_style` | style of img links inserted when pasting images from clipboard | wiki |
| | `markdown` ... `![image name](image_subdir/xxxxx.png)` | |
| | `markdown` ... `![](image_subdir/xxxxx.png)` | |
| | `wiki` ... `![[image name]]` | |
| `extension` | filename extension of your note files | .md |
| `follow_creates_nonexisting` | following a link to a non-existing note will create it | true |

View File

@@ -74,7 +74,7 @@ telekasten.setup({opts})
-- image link style",
-- wiki: ![[image name]]
-- markdown: ![image name](image_subdir/xxxxx.png)
-- markdown: ![](image_subdir/xxxxx.png)
image_link_style = "wiki",
@@ -152,7 +152,7 @@ telekasten.setup({opts})
Valid options are:
- 'wiki' .. places links like this: `![[image_name]]`
- 'markdown' .. `![image_name](image_subdir/image_name)`
- 'markdown' .. `![](image_subdir/image_name)`
Default: 'wiki'

View File

@@ -40,7 +40,7 @@ local ZkCfg = {
-- image link style
-- wiki: ![[image name]]
-- markdown: ![image name](image_subdir/xxxxx.png)
-- markdown: ![](image_subdir/xxxxx.png)
image_link_style = "wiki",
-- integrate with calendar-vim
@@ -117,7 +117,7 @@ local imgFromClipboard = function()
os.execute("xclip -selection clipboard -t image/png -o > " .. pngpath)
if file_exists(pngpath) then
if ZkCfg.image_link_style == "markdown" then
vim.api.nvim_put({ "![" .. pngname .. "](" .. relpath .. "]" }, "", false, true)
vim.api.nvim_put({ "![](" .. relpath .. "]" }, "", false, true)
else
vim.api.nvim_put({ "![[" .. pngname .. "]]" }, "", false, true)
end