That was my first thought too. Unfortunately, I don't see how it's possible. 
According to [markdown's 
code](https://github.com/waylan/Python-Markdown/blob/2.2.1.final/markdown/__init__.py#L267-L271)
 treeprocessors run before postprocessors. The TOC is implemented as 
[treeprocessor](https://github.com/waylan/Python-Markdown/blob/2.2.1.final/markdown/extensions/toc.py#L18).
 But output of "include" macros inserted into final page only on 
[postprocessors 
stage](https://github.com/waylan/Python-Markdown/blob/2.2.1.final/markdown/postprocessors.py#L48).

The only way we can make TOC later is re-implementing it from scratch as a 
postprocessor, which would search for headers and modify final html string to 
include table of contents. This approach would be also error-prone and hard to 
maintain...


---

** [tickets:#4771] TOC macro doesn't add headers of included pages [ss246]**

**Status:** in-progress
**Milestone:** unreleased
**Labels:** p3 support 42cc sf-current sf-2 
**Created:** Thu Aug 23, 2012 12:41 PM UTC by Chris Tsai
**Last Updated:** Tue Nov 11, 2014 07:26 PM UTC
**Owner:** Igor Bondarenko

[forge:site-support:#246]

>On the page above there is a table of contents just underneath the Versions 
>Heading, and then each of the headings after that are included from seperate 
>pages per version. I would expect that the table of contents to display the 
>headings from the included pages as well as the headings from the current 
>page. This does not happen.

>It may just be me not quite understanding it, however it would be nice to have

I've put together a page demonstrating this here: 
https://sourceforge.net/p/strawhat/wiki/top/


---

Sent from forge-allura.apache.org because [email protected] is subscribed 
to https://forge-allura.apache.org/p/allura/tickets/

To unsubscribe from further messages, a project admin can change settings at 
https://forge-allura.apache.org/p/allura/admin/tickets/options.  Or, if this is 
a mailing list, you can unsubscribe from the mailing list.

Reply via email to