diff options
| author | Robert Günzler <r@gnzler.io> | 2025-01-13 13:47:36 +0100 |
|---|---|---|
| committer | Robert Günzler <r@gnzler.io> | 2025-01-13 14:12:10 +0100 |
| commit | b0111a19e6e86e275e1af0c85699b20f254c149f (patch) | |
| tree | 48aa4bede1798b11db29669af6b0e97736a984b5 /preproc.lua | |
| parent | 60677f2dea5418527aadc7f6c6bbb7f3b94a5aa9 (diff) | |
| download | site-b0111a19e6e86e275e1af0c85699b20f254c149f.tar.gz | |
set target=_blank on outgoing links via preproc.lua
Signed-off-by: Robert Günzler <r@gnzler.io>
Diffstat (limited to 'preproc.lua')
| -rw-r--r-- | preproc.lua | 7 |
1 files changed, 7 insertions, 0 deletions
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 = {} |