markdoc icon indicating copy to clipboard operation
markdoc copied to clipboard

TOC output improvement

Open artob opened this issue 15 years ago • 6 comments

There's a bit of an issue with being able to effectively use the TOC extension with Markdoc: the TOC output includes the h1-level header used as the Markdoc page title, which goes against the principle of least surprise. This means in practice that the TOC output is a little uselessly redundant, since Markdoc pages are not likely to have more than one h1. If one places the TOC directly after the page title, the redundancy really pokes one in the eye.

In case there exists some way to specify that the TOC output should only include h2-level headers and their children, that'd be fantastic. I realize this isn't really a Markdoc issue per se, but one concerning the TOC extension. However, perhaps Markdoc has some degree of control here internally, within which scope the output could be remedied? I can't really imagine that when using the TOC extension with Markdoc anyone could want the h1-level titles as part of the TOC, so it wouldn't even need to be configurable.

artob avatar Sep 15 '10 13:09 artob

The TOC extension doesn’t seem to support any kind of filtering. I agree that it’s stupid to be displaying the h1 in the TOC, so perhaps I’ll hack together a custom plugin that supports this kind of filtering.

As a side-note, I’m thinking about Markdoc.rb. It would make configuration and extension a lot easier.

zacharyvoase avatar Sep 15 '10 14:09 zacharyvoase

Oh man, you just made my day: Markdoc.rb would rock, hard.

Only topic of concern: the Python Markdown implementation seems pretty awesome, with all the extensions it has. I'm not certain Ruby has (yet) anything truly comparable? Then again, I do believe that a couple of the Ruby implementations have e.g. math notation support built in - so maybe it's a question of trade-offs.

artob avatar Sep 15 '10 14:09 artob

Kramdown looks promising: http://kramdown.rubyforge.org/quickref.html

The inline attribute list syntax would also be very useful for RDFa :)

zacharyvoase avatar Sep 15 '10 14:09 zacharyvoase

Imagine this:

I love [Ruby][]{:rel="foaf:interest"}.

Kramdown is very nice indeed.

zacharyvoase avatar Sep 15 '10 19:09 zacharyvoase

Kramdown was the one that had nice inline LaTeX math support as well: http://kramdown.rubyforge.org/syntax.html#math-blocks

artob avatar Sep 15 '10 20:09 artob

I added some formatting for TOC using javascript to add classes. It also implements Foundation 4. https://github.com/blitzagency/markdoc-theme

ifnull avatar Apr 19 '13 05:04 ifnull