From: Waylan L. <wa...@gm...> - 2008-10-17 16:13:26
|
On Fri, Oct 17, 2008 at 11: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. Yeah, I've made that mistake before as well. Perhaps we need a better config system. I'll have to think about that. > >> > * 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. Fair enough. Personally, I like it when a little paragraph symbol appears to the right of a header on hover, rather than the entire header being an anchor, but that may be beyond this extension (unless it was a third option) as the user would have to provide their own css etc. The current implementation is certainly good enough (tm). > >> > * 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. Well, mostly. Now, if a header already has an id, both the header and anchor will get the id. As ids should be unique, this creates invalid html. I'd suggest *not* assigning an id to the anchor - just the header. And speaking of unique, how are you guaranteeing that slugify does not create the same id for two different headers? Not a showstopper, but something to think about. You might be interested in how HeaderID addresses this. > > The code has been updated: > http://codezen.org/static/toc-updated.py > I don't mean to be so nitpicky Jack, but I would like something like this packaged up with Markdown and it has to be right before that happens. When I'm happy with it and with your blessings (and no objection from Yuri) I'll commit it to the repo. -- ---- Waylan Limberg wa...@gm... |