emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Exporting in html with numeric references to headlines


From: Nick Dokos
Subject: Re: [O] Exporting in html with numeric references to headlines
Date: Mon, 15 Jul 2019 18:54:36 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Shérab <address@hidden> 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




reply via email to

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