emacs-orgmode
[Top][All Lists]
Advanced

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

Re: Extract toc from org file


From: Ihor Radchenko
Subject: Re: Extract toc from org file
Date: Tue, 27 Sep 2022 15:08:21 +0800

reza <reza@housseini.me> writes:

> I'm using org publish, but the sitemap does only collect the titles from 
> org files but I want the complete toc of each file and as far as I 
> undesrand this is not possible with sitemap?

You just need a custom :sitemap-function.
The default `org-publish-sitemap-default' flattens the hierarchy.

>From the manual:

‘:sitemap-function’
     Plug-in function to use for generation of the sitemap.  It is
     called with two arguments: the title of the site-map and a
     representation of the files and directories involved in the project
     as a nested list, which can further be transformed using
     ‘org-list-to-generic’, ‘org-list-to-subtree’ and alike.  Default
     value generates a plain list of links to all files in the project.

You may create a function similar to `org-publish-sitemap-default' but
using `org-list-to-subtree' instead of `org-list-to-org'

>> If you are exporting a single Org file that is using contents of
>> multiple #+include'd files, you can use the normal TOC generation as
>> described in 13.3 Table of Contents section of the Org manual.
>
> But this forces all the content into a single file, no?

Yes, it will. It is indeed not something you want in your use case.

-- 
Ihor Radchenko,
Org mode contributor,
Learn more about Org mode at https://orgmode.org/.
Support Org development at https://liberapay.com/org-mode,
or support my work at https://liberapay.com/yantar92



reply via email to

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