Fossil Forum

Table of content in long documents like "Fossil vs Git"
Login

Table of content in long documents like "Fossil vs Git"

Table of content in long documents like "Fossil vs Git"

(1) By Offray (offray) on 2020-02-02 18:52:57 [link] [source]

Hi,

I am having a talk about migrating the source code of a project from and old DVCS (SmalltalkHub) to a more modern one. Of course, my choice would be Fossil, but that requires improved support between Pharo and Fossil which now is almost non-existent, and we are discussing right now if maybe that would be a first step.

Anyway, while arguing in favor of Fossil, I tried to share a link to the section 2.5 of "Fossil vs Git"[1] and I didn't find an easy way to do it. I think that long documents like that one, could benefit from and explicit lateral table of contents. Could this be added?

[1] https://fossil-scm.org/home/doc/trunk/www/fossil-v-git.wiki

Thanks,

Offray

Ps: I tried to ask for this as a new ticket in Fossil main repository, but didn't find a quick way to do it (It seems that the anonymous ticket is disabled).

(2) By Warren Young (wyoung) on 2020-02-02 23:50:11 in reply to 1 [source]

I tried to share a link to the section 2.5 of "Fossil vs Git"1 and I didn't find an easy way to do it.

Right-click the text you want to link to, say "Inspect" (language varies by browser) and look for nearby HTML tags like <a id="foo"> or <a name="bar">. These are element IDs and named anchors, respectively, which you can link to using #foo or #bar links in URLs. In this particular case, you want to link here.

I think that long documents like that one, could benefit from and explicit lateral table of contents.

You could have picked a better example: the big table in section 2.0 of that document is a table of contents. It isn't explicitly marked "Table of Contents," but it's a table, and it lists the contents, and it links to the individual sections of the document below.

I didn't bother linking to section 2.5 because the paragraphs under that particular header are summary paragraphs for the sub-sections below, so I decided to link to those sub-sections instead.

To get past this particular example, it would be possible for Fossil to automatically generate such things for /wiki and /doc URLs as an extension to the markdown-header-ids feature. I'm sure Stephan wouldn't turn down help getting that branch into shape for merging to trunk. That means not just code commits but also participation in the discussion thread to resolve open questions.

That feature implicitly collects a list of headers and creates fragment identifiers for them, so you could then extend it to automatically create a table of contents.

That then makes us ask, "So what do we do with that info once we have it?" I see several options:

Submenu

Up at the top of wiki pages, there is a sub-menu, to which we could add a "ToC" link that would show the list, perhaps using a mechanism like the default skin's hamburger menu. /doc URLs could also have such a sub-menu.

Sidebar

Fossil could inject a <div style="float: left"> box into the content area of doc pages to contain the ToC and possibly other material.

The main problem here is that it could interfere with existing skins; a one-size-fits-all implementation may break some skins.

We may need some kind of extension to the skinning mechanism to let skin authors tell Fossil "sidebars go here," letting the skin provide the container, into which Fossil injects unstyled purely semantic HTML.

Inline

Another possibility is inline ToC, much like Wikipedia does.

It looks like MediaWiki just automatically jams to ToC block in before the first second-level header, which could cause problems for historical Fossil repos with docs created without that prior understanding.

What might work better for Fossil is a markup language extension that gives authors a marker that Fossil can see and replace with the ToC, such as $TOC. Then the author can place the ToC wherever they like in the doc, even into a floating <div> off to the side, if they want.

(3) By Offray (offray) on 2020-02-03 14:36:14 in reply to 2 [link] [source]

Thanks a lot Warren for this detailed answer.

(4) By anonymous on 2020-02-03 18:13:35 in reply to 2 [link] [source]

What might work better for Fossil is a markup language extension that gives authors a marker that Fossil can see and replace with the ToC

The CommonMark community is discussing extension syntax to support things like tables of content. There are 2 options, currently, one of which uses { and } while the other uses :