-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TOC #16
Comments
Should be possible to do fairly easily. Might this be extend to lists of other types too? Lists of tables perhaps (using table captions in place of Foo and Bar from your example above. Or maybe HTML5 sections or figures? |
I would support this idea. To illustrate how useful this feature is, here is a simple example of the TOC syntax in reStructuredText that shows how it works there:
And instead of
you may also write
to replace the default title "Contents". This can be tried in a reST sandbox, and there are other options also. So what about using:
to generate a TOC in Textile, for example? Alternatively toc1. , toc2. , and so on could be used for different depths. |
Excellent possibilities here. So as a Textplug, you would need to be able to parse the whole document. I guess that won't work with the current block-level callback? |
Nope. Currently they only get a callback as the blocks are parsed, in order. This would require a two pass approach, as taken by notelists. First pass collates the data, second pass sorts it and inserts it. Doesn't mean it's impossible -- just not with the current block-level callbacks. |
Don’t know what the state of callbacks is these days but a more dynamic Handling of ToCs would be sweet, so it wasn’t so tedious to edit a static one when sections change. |
Just remembered there's the soo_toc plugin for Txp, and it works perfectly with only minor extra fuss to ensure id selectors are in headers. I'm happy. |
The addition of notelist. suggests doing something similar for a table of contents based on header IDs. Rather than trying to make a proper nested list out of it, an expedient hack would be to give each item in the TOC a class based on the header level:
The text was updated successfully, but these errors were encountered: