Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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.jpg">"test"` because the path is considered as an absolute file path.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don’t think you meant .jpg here.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed forgot to change that one... I was tired after studying how it all worked


In order to correctly generate internal link urls, you may write `[[int-url:./test][test]` (i.e. JUST THE FILENAME WITHOUT THE .org EXTENSION PART), 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/index.html\">\"%s\"" path desc))))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don’t include index.html in those links. It’s not necessary, and we allow changing the filename.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah thanks didn't know that. just starting with nikola

(org-add-link-type "int-url" 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