Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions v8/orgmode/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 `<img src="/images/test.jpg" alt="test.jpg">`.

The internal link in ox-html is a little fuzzy. For example, `[[./test.org][test]]` will be generated as `<a href="file:///./test.org">"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 <a href="./test/index.html">"test".
7 changes: 7 additions & 0 deletions v8/orgmode/init.el
Original file line number Diff line number Diff line change
Expand Up @@ -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 "<a href=\"%s/\">\"%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
Expand Down