emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nick Dokos <ndokos@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: Exporting in html with numeric references to headlines
Date: Mon, 15 Jul 2019 18:54:36 -0400	[thread overview]
Message-ID: <8736j629jn.fsf@alphaville.usersys.redhat.com> (raw)
In-Reply-To: 20190715171632.GA24689@om.localdomain

Shérab <Sebastien.Hinderer@ens-lyon.org> writes:

> Dear all,
>
> Assume the following document:
>
> ===
>
> #+title: test1
>
> * Introduction
>
> Monads will be explained in chapter [[#monads]]
>
> * Monads
>   :PROPERTIES:
>   :CUSTOM_ID: monads
>   :END:
>
> Welcome to the monads chapter.
>
> ===
>
> When I export this to html, the paragraph in the introduction says:
>
> Monads will be explained in chapter 2
>
> with "2" being a link, which is what I am expecting. However the link
> does not work and it seems the "#monads" anchor is actually not created.
> I can also observe that the links in the table of contents do not seem
> to work either.
> Am I doing something wrong? I also tried different variations with
> <<chap:monads>> but was not able to make anything work.

As Bruno Barbier points out, you are probably OK: you just have to add
more stuff in the first chapter, so that when you click the link, the change
is visible.

Another way to see it is to look at the HTML file that is
produced: if that contains what you expect, then you should be
OK. That is a technique that is often useful in debugging export
problems, e.g. I often export to PDF (via LaTeX) and I look at the
produced LaTeX file (and sometimes tinker with it and process it
until I figure out what's wrong).

In this case, the HTML looks like this:

,----
| ...
| <div id="outline-container-org3629b2d" class="outline-2">
| <h2 id="org3629b2d"><span class="section-number-2">1</span> Introduction</h2>
| <div class="outline-text-2" id="text-1">
| <p>
| Monads will be explained in chapter <a href="#monads">2</a>
| </p>
| </div>
| </div>
| <div id="outline-container-org58a95fc" class="outline-2">
| <h2 id="monads"><span class="section-number-2">2</span> Monads</h2>
| <div class="outline-text-2" id="text-monads">
| <p>
| Welcome to the monads chapter.
| </p>
| </div>
| </div>
| ...
`----
which looks correct: the #monads href links the <h2 id="monads"> tag.
To test Bruno's hypothesis, I even added a bunch of

,----
| Lorem ipsum <br/>
`----

lines between the chapters right in the HTML file to make the second
chapter move down "below the fold" and see whether clicking the link
works: it did.

HTH.
-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler

      parent reply	other threads:[~2019-07-15 22:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-15 17:16 Exporting in html with numeric references to headlines Shérab
2019-07-15 19:18 ` Bruno Barbier
2019-07-16  6:13   ` Shérab
2019-07-16 19:27     ` Bruno Barbier
2019-07-15 22:54 ` Nick Dokos [this message]

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=8736j629jn.fsf@alphaville.usersys.redhat.com \
    --to=ndokos@gmail.com \
    --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).