FransBouma / DocNet

Your friendly static documentation generator, using markdown files to build the content.
http://fransbouma.github.io/DocNet/
248 stars 36 forks source link

Support heading 3 items in the side-ToC (as option?) #59

Closed GeertvanHorrik closed 7 years ago

GeertvanHorrik commented 7 years ago

See for example this page:

http://docs.catelproject.com/vnext/reference/Catel.Core/Catel/Argument.htm

Would be extremely useful to have a list of properties / methods on the left side as well. I can create a PR if you are interested.

FransBouma commented 7 years ago

The page you link to shows a ToC that's showing only the H2? H3's as well as H2's... I've tried that initially but it didn't look great.

GeertvanHorrik commented 7 years ago

The thing is that H1 is not supported in the ToC as well. So we can only have top-levels as docs. But then it would only show Properties, Methods, etc. If I make these H1, then it just looks like big pile of members.

As an additional option (off by default)?

FransBouma commented 7 years ago

H1 is the page title, so the type you're generating the docs for. H2's are then the sections in the page, like properties, methods. I see your point of adding H3's for this particular case, but I really have to see the HTML and layout. As I said, I tried to add it (as a bigger ToC helps discoverability) but never got a layout which really looked OK, it was always a mess.

GeertvanHorrik commented 7 years ago

Let me introduce the option in a fork and you can always decide whether you want to support this or not.

GeertvanHorrik commented 7 years ago

I am currently making the following changes:

  1. Instead of tracking just h2, track all h elements in a list
  2. Create a hierarchy at the end (covered with unit tests)
  3. Add a MaxToCLevel (defaults to 2)

This way we can easily extend the behavior (e.g. I can pass in 3, and it should auto generate 3 levels, etc)

FransBouma commented 7 years ago

Ok, but with what HTML? :) Say I have 4 levels, how will that look like?

GeertvanHorrik commented 7 years ago

That's up to the one that wants to include 4 levels ;-)

I am just adding the technical possibility to deal with multiple levels of headings (instead of just h2). Once that is done, we can simple see how it deals with these levels.

FransBouma commented 7 years ago

Ok. Building the hierarchy can be tricky though, as well as keeping track if which element belongs to what: there can be an H2 and an H4, but no H3 between them. I think it can be done without the need of building a hierarchy at the end, as the file is parsed from top to bottom, so you know what the current 'top' / previous element level is.

GeertvanHorrik commented 7 years ago

I have unit tests for that scenario :)

GeertvanHorrik commented 7 years ago

image

FransBouma commented 7 years ago

Cool! :)

I have unit tests for that scenario :)

Famous Last Words (tm) ;)