From: Waylan L. <wa...@gm...> - 2008-10-17 17:43:40
|
On Fri, Oct 17, 2008 at 12:31 PM, Yuri Takhteyev <qar...@gm...> wrote: > Thanks. I appreciate you doing this work. > > I checked the extension in under markdown_extensions/toc.py and put a > test file under tests/extensions-x-toc/syntax-toc.txt. > > I can't get it to work for some reason, though. The file extension > loads and does add the IDs, but doesn't seem to add the anchors or the > actual TOC. Am I missing something? Just guessing, but did you turn on anchors in the config (it's off by default - and should be IMO)? And did you add the marker ``[TOC]`` to the document for placement of the TOC. Which brings to mind another thought I had when I was planning my approach to this. What should be the default behavior when the document does not contain a marker? I can think of 3 reasonable behaviors: 1. Do nothing (current implementation). Without a marker you don't get a TOC - just ids. Although the HeaderID ext already gives you this, so the only value here is when an author wants some documents to have a TOC, but not others. 2. Insert the TOC into the beginning of the document by default. Although, this may be undesireable in some instances, so would need to be configurable. 3. Make the TOC available as an attribute on the Markdown class (much like Meta-Data ext does). This way a templating system could place the TOC elsewhere in a HTML template for a document if desired. Actually, this could happen regardless of 1 or 2. > > - yuri > > On Fri, Oct 17, 2008 at 8:13 AM, Jack Miller <ja...@co...> wrote: >> On Fri, Oct 17, 2008 at 09:30:49AM -0400, Waylan Limberg wrote: >>> Oh, one other thing, wrap the toctitle in an if statement and only add >>> it if a title is set in the config settings. Right now your getting a >>> blank title ``<span class="toctitle" />``. >>> >> >> Yeah, I actually just forgot the [0] on the config, so typo fixed. >> >>> > * Why are you creating anchors in each header? Why not just assign >>> > each header an "id" attribute? That is generally considered the >>> > correct way to do things and works just the same. >>> > >> >> Well, I like the headers to be turned into links. As with a lot of things >> that are pure preference, I just turned it into a config option (anchorlink) >> which defaults to 0, but if set makes the link. >> >>> > * It would be nice if it worked with the HeaderID extension. That is, >>> > if a header already has an id attribute, that is used rather than >>> > recreating one which may be different. >> >> Ah yes. Fixed. >> >> The code has been updated: >> http://codezen.org/static/toc-updated.py >> >> --Jack >> >> ------------------------------------------------------------------------- >> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge >> Build the coolest Linux based applications with Moblin SDK & win great prizes >> Grand prize is a trip for two to an Open Source event anywhere in the world >> http://moblin-contest.org/redirect.php?banner_id=100&url=/ >> _______________________________________________ >> Python-markdown-discuss mailing list >> Pyt...@li... >> https://lists.sourceforge.net/lists/listinfo/python-markdown-discuss >> > > > > -- > http://sputnik.freewisdom.org/ > -- ---- Waylan Limberg wa...@gm... |