diff --git a/v8/orgmode/README.md b/v8/orgmode/README.md index eedcc311..740cb696 100644 --- a/v8/orgmode/README.md +++ b/v8/orgmode/README.md @@ -44,3 +44,7 @@ because the path is considered as an absolute file path. In order to correctly generate image urls, you may write `[[img-url:/images/test.jpg]]`, and then it should be generated as `test.jpg`. + +The internal link in ox-html is a little fuzzy. For example, `[[./test.org][test]]` will be generated as `"test"` because the path is considered as an absolute file path. + +In order to correctly generate internal link urls, you may write `[[internal:./test.org][test]`, and then it should be generated as "test". diff --git a/v8/orgmode/init.el b/v8/orgmode/init.el index 93b29672..461f33d6 100644 --- a/v8/orgmode/init.el +++ b/v8/orgmode/init.el @@ -111,6 +111,13 @@ contextual information." (pygmentize (downcase lang) (org-html-decode-plain-text code))) code-html)))) +;; Export internal links with custom link type +(defun org-custom-internal-link-url-export (path desc format) + (cond + ((eq format 'html) + (format "\"%s\"" (substring path 0 -4) desc)))) +(org-add-link-type "internal" nil 'org-custom-internal-link-url-export) + ;; Export images with custom link type (defun org-custom-link-img-url-export (path desc format) (cond