File tree Expand file tree Collapse file tree 3 files changed +11
-7
lines changed Expand file tree Collapse file tree 3 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -71,7 +71,10 @@ formats.date_short = function(id, db)
7171end
7272
7373formats .link = function (id , db )
74- return db [id ].link and db [id ].link :sub (1 , 90 ) or " "
74+ local utils = require (" feed.utils" )
75+ local link = db [id ].link and db [id ].link or " "
76+ link = utils .truncate (link , 90 )
77+ return " <" .. link .. " >"
7578end
7679
7780formats .feed = function (id , db )
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ function Writer(doc, opts)
2525 ref_counter = ref_counter + 1
2626 refs [ref_counter ] = elem .target
2727 local text = pandoc .utils .stringify (elem .content )
28- return pandoc .RawInline (" markdown" , " [" .. text .. " ][" .. ref_counter .. " ]" )
28+ return pandoc .RawInline (" markdown" , " [" .. text .. " ][^ " .. ref_counter .. " ]" )
2929 end ,
3030 Image = function (elem )
3131 if elem .src :find (" data:image/svg%+xml" ) then
@@ -53,7 +53,7 @@ function Writer(doc, opts)
5353 if ref_counter > 0 then
5454 table.insert (links_blocks , pandoc .Strong (" Links" ))
5555 for i = 1 , ref_counter do
56- table.insert (links_blocks , pandoc .Para (pandoc .Str ((" [%d] %s " ):format (i , refs [i ]))))
56+ table.insert (links_blocks , pandoc .Para (pandoc .Str ((" [^ %d] <%s> " ):format (i , refs [i ]))))
5757 end
5858 new_doc .blocks = new_doc .blocks .. links_blocks
5959 end
Original file line number Diff line number Diff line change 2929
3030--- Returns all URLs in markdown buffer, if any.
3131--- @param cur_link string
32+ --- @param lines ? string[]
3233--- @return string[][]
33- M .get_urls = function (cur_link )
34- local lines = vim .api .nvim_buf_get_lines (0 , 0 , - 1 , false )
34+ M .get_urls = function (cur_link , lines )
35+ lines = lines or vim .api .nvim_buf_get_lines (0 , 0 , - 1 , false )
3536 local res = { cur_link }
3637 for _ , line in ipairs (lines ) do
37- if line :match (" ^%[%d+%] %s*" ) then
38- local url = line :match (" %[%d+%] %s*(%S+)" )
38+ if line :match (" ^%[%^% d+%]%s*" ) then
39+ local url = line :match (" %[%^% d+%] %s*< (%S+)> " )
3940 table.insert (res , url )
4041 end
4142 end
You can’t perform that action at this time.
0 commit comments