[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] Unexpected link behavior after exporting Org-mode file to HTML

From: Bruce Gilstrap
Subject: [O] Unexpected link behavior after exporting Org-mode file to HTML
Date: Thu, 18 Sep 2014 10:09:12 -0500


I am running Org-mode 8.2.7c in Emacs 24.3.1 on Windows 7 Ultimate and
have encountered a peculiarity with how links work in HTML exported
from Org-mode. I searched gmane.emacs.orgmode to see if someone else
has reported this before, but I didn't find anything exactly like
this. Please pardon me if I have missed something.

I have used org-id extensively to assign unique IDs to headings in
Org-mode files (stored in the :PROPERTIES: drawer of the heading).
Before the new exporter framework was introduced in Org-mode 8.0 all
of these links worked without issue: no matter the level of the
heading's hierarchy, exported-HTML ID-based links worked fine.
However, using the new exporter framework produces different results.
Now, ID-based links always fail when the target heading lies at a
level below the headline level defined in the export settings, which
defaults to level 3 (H:3). Note: This is true only for the exported
HTML; ID-based links work perfectly within Emacs.

Here is a minimal example that demonstrates this behavior when I
export it to HTML (see annotations for details):

#+OPTIONS: toc:nil
* Headline Level 1
** Headline Level 2
*** Headline Level 3
:ID:       307db49e-e001-4a7b-9541-96eee2ae6f06
**** <<heading-level-4>>Non-headline level
:ID:       3be9179d-f838-4052-93ca-6c76c9aff12d
* Headline Level 1
Now I want to link to information that appears elsewhere in the file.
Links work as expected within Emacs. When exported to HTML, however,
links do not work as they did before the new exporter framework was
introduced in Org-mode 8.0.
[[id:307db49e-e001-4a7b-9541-96eee2ae6f06][ID-based link to 1.1.1]]
This link /does/ work. Using IDs always works for links to any
headline level. By "headline level" I mean any Org-mode heading that
is defined as a headline (default H:3).
[[id:3be9179d-f838-4052-93ca-6c76c9aff12d][ID-based link to Non-headline level]]
This link using the ID /doesn't/ work when exported to HTML using the
new exporter framework. Now, using IDs as the target for links
/always/ fails for links to any headline lower than the headline level
defined in the export settings.
[[heading-level-4][Non-ID-based link to Non-headline level]]
Using an internal link works, but I have /many/ existing files that
depend on IDs for links at heading levels lower than the levels I want
treated as (numbered) headlines.

You can view the exported HTML file here:

I believe the relevant function in ox-html.el is org-html-headline,
but I'm a novice (at best) with elisp.

My questions are these:
1. Is this behavior by design?
2. If so, how can I make ID-based links to non-headlines work the way
I expect them to?
3. If not, shouldn't this be treated as a bug?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]