Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

customize the template for .TableOfContents #225

Open
ktmud opened this Issue · 2 comments

3 participants

@ktmud

I want to make it work with Bootstrap's scrollspy, but the html structure seems to be hardcoded.

@spf13
Owner

That would be awesome. There's already a similar request in the parent library russross/blackfriday#51

We could always fork the parent and add our own support, but I would rather work with them if at all possible. Perhaps adding a comment on that ticket would help... or a PR

@spf13 spf13 added the enhancement label
@kdar

It's kind of unfortunate that blackfriday doesn't parse into a syntax tree before outputting html. I would love to have .TableOfContents just be a Go struct/map/whatever that I can iterate to generate the TOC. Blackfriday has a Renderer interface but it forces you to copy/paste the entire Html{} code in order to modify anything (which could be an option for hugo. Implement its own Renderer).

It seems the other option would be to HTML parse the <nav> and then be able to build the struct/map/whatever from that. Could use an HTML parser like code.google.com/p/go.net/html or something else. Could also possible simplify the hugolib.extractTOC function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.