From b0111a19e6e86e275e1af0c85699b20f254c149f Mon Sep 17 00:00:00 2001 From: Robert Günzler Date: Mon, 13 Jan 2025 13:47:36 +0100 Subject: set target=_blank on outgoing links via preproc.lua MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Robert Günzler --- preproc.lua | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'preproc.lua') diff --git a/preproc.lua b/preproc.lua index 6bfa8c5..7be9a48 100644 --- a/preproc.lua +++ b/preproc.lua @@ -1,6 +1,13 @@ ---@diagnostic disable: undefined-global -- see https://pandoc.org/lua-filters.html return { + Link = function(link) + -- set target="_blank" for outgoing links (open them in new tab) + if string.match(link.target, "gzr.im") == nil then + table.insert(link.attributes, { "target", "_blank" }) + end + return link + end, Pandoc = function(doc) local front = {} -- cgit 1.4.1