public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: John MacFarlane <fiddlosopher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
Subject: Re: EPUB toc for whole book?
Date: Sat, 28 Apr 2012 08:03:16 -0700	[thread overview]
Message-ID: <20120428150316.GA405@protagoras.phil.berkeley.edu> (raw)
In-Reply-To: <4232951.768.1335608514852.JavaMail.geo-discussion-forums@vbbgl4>

+++ niczero [Apr 28 12 03:21 ]:
>    Hi David,
>    I just joined this group for the very purpose of reporting that
>    internal links between chapters don't work
>    (in .epub).  I haven't yet homed-in on why, but any internal links in
>    one chapter
>    ("see [Chapter 2](#ch2)") just get left as they are, so my .epub
>    contains original fragments of md
>    where the links should be.  I tried moving the anchor away from the
>    heading, so the .md has
>    "
>    # Chapter 2
>    <a name="ch2">.</a>
>    "
>    but that didn't help.  I'm now busy hunting for a workaround because
>    each chapter is littered with
>    references to other chapters, there are 108 chapters, and having
>    hyperlinking working is a big
>    part of why I'm building the ebook.

Internal links between chapters do work in pandoc 1.9.2 -- but
maybe not in the way you expect. You need to create
the links using the implicit identifiers described in
<http://johnmacfarlane.net/pandoc/README.html#header-identifiers-in-html-latex-and-context>.

So, to link to

    # Chapter 2

what you want is

    See [Chapter 2](#chapter-2)

Try that.  The reason the raw HTML anchors don't work is that the
epub gets split over several different files.

>    By the way, all my chapter headings appear in the book's toc, but they
>    didn't originally.  In my
>    first draft some of my headings were non-unique.  When I fixed that,
>    the toc appeared.  Are you
>    getting anything at all?  Originally I had just two entries, the title
>    page and one 'chapter' for the
>    entire book.
>    When I say 'toc', I mean what I see when I click on 'contents' in the
>    calibre ebook reader; it
>    doesn't appear within the body of the book.

Here's how pandoc currently handles these things.  Your document is
divided into chapters by level-1 headers.  If you only have one
level-1 header, you'll only get one chapter.  Your epub reader will
have a master table of contents showing these chapters.  This is
independent of whether you use --toc on the command line.  If you
use --toc, you'll *also* get a table of contents for each chapter,
at the beginning of that chapter.

It may be possible to change things so that the master table of
contents shows all the sections and subsections; I can look into
that if people are interested.  (It would be helpful if someone
gave me an example of an epub that worked that way, so I can see
how it's done.)

John


  reply	other threads:[~2012-04-28 15:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-27 21:09 David Snopek
2012-04-28 10:21 ` niczero
2012-04-28 15:03   ` John MacFarlane [this message]
     [not found]     ` <20120428150316.GA405-nFAEphtLEs+AA6luYCgp0U1S2cYJDpTV9nwVQlTi/Pw@public.gmane.org>
2012-04-29 13:49       ` niczero
2012-04-29 16:31         ` John MacFarlane
     [not found]           ` <20120429163127.GC24897-nFAEphtLEs+AA6luYCgp0U1S2cYJDpTV9nwVQlTi/Pw@public.gmane.org>
2012-04-29 21:18             ` niczero
2012-04-29 21:37               ` John MacFarlane
2012-05-07 22:13       ` David Snopek
2012-10-26  5:16 ` Jason Morrison
     [not found]   ` <8cc0d96a-d364-4f03-a7bb-3b0b558fa857-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2012-10-26  6:17     ` fiddlosopher

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

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

  git send-email \
    --in-reply-to=20120428150316.GA405@protagoras.phil.berkeley.edu \
    --to=fiddlosopher-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.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.
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 NNTP newsgroup(s).