Stop org-mode export adding file:// to relative links
This commit is contained in:
parent
b8890b0176
commit
ba3fb5be9f
1 changed files with 15 additions and 0 deletions
15
config.org
15
config.org
|
@ -548,6 +548,21 @@ Export external links as ~target= “_blank”~, from [[https://emacs.stackexcha
|
|||
'my-org-export-add-target-blank-to-http-links)
|
||||
#+END_SRC
|
||||
|
||||
Get rid of =file://= using the same method.
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun my-org-export-correct-file-links (text backend info)
|
||||
"Add target=\"_blank\" to external links."
|
||||
(when (and
|
||||
(org-export-derived-backend-p backend 'html)
|
||||
(string-match "href=\"file[^\"]+" text))
|
||||
(string-match "file://" text)
|
||||
(replace-match "" nil nil text)))
|
||||
|
||||
(add-to-list 'org-export-filter-link-functions
|
||||
'my-org-export-correct-file-links)
|
||||
#+END_SRC
|
||||
|
||||
*** Packages
|
||||
|
||||
**** =org-agenda-property=
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue