emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bruce Gilstrap <bruce@gilstraps.org>
To: emacs-orgmode@gnu.org
Subject: Unexpected link behavior after exporting Org-mode file to HTML
Date: Thu, 18 Sep 2014 10:09:12 -0500	[thread overview]
Message-ID: <CAN_bDiCCcvqbsXv+DBCKu6niTdDMg7k1gN1LETirW_J-AuqESw@mail.gmail.com> (raw)

Hello,

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
:PROPERTIES:
:ID:       307db49e-e001-4a7b-9541-96eee2ae6f06
:END:
**** <<heading-level-4>>Non-headline level
:PROPERTIES:
:ID:       3be9179d-f838-4052-93ca-6c76c9aff12d
:END:
* 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:
http://work.gilstraps.org/org/demo-links.html

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?

Thanks,
Bruce

             reply	other threads:[~2014-09-18 15:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-18 15:09 Bruce Gilstrap [this message]
2014-09-18 20:11 ` Unexpected link behavior after exporting Org-mode file to HTML Nicolas Goaziou
2014-09-18 21:06   ` Bruce Gilstrap

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAN_bDiCCcvqbsXv+DBCKu6niTdDMg7k1gN1LETirW_J-AuqESw@mail.gmail.com \
    --to=bruce@gilstraps.org \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).