Skip to content

Mini-TOC Macro #245

Open

Description

@eguvep

Thanks for providing LiaScript! It is much improving how we provide OER content!
Structuring my courses, I regularly end up with slides that are empty, except of the chapter-title. This pages may appear to users as if the content is not loading or so.
Wouldn't it be nice to have a mini table of contents (mini-toc) on this empty pages, just listing the sub-chapters?
It is possible to create such a mini-toc manually:

# heading

[subheading1](#subheading1)

[subheading2](#subheading2)

## subheading1

lorem ipsum

## subheading2

lorem ipsum

It would be more convenient to have something like this:

# heading

@mini-toc

## subheading1

lorem ipsum

## subheading2

lorem ipsum

You find an example course at https://fh.ms/floss.
I tried to write a JavaScript but failed.

Activity

  1. andre-dietrich commented on Sep 16, 2025

    @andre-dietrich
    Member

    Hi, and a very nice course, thank you for using LiaScript ;-) ... providing a @mini-toc with javascript is possible, but it would be a weird hack ... I think for such purposes, it would be good to have a general solution, with parameters @mini-toc(start, depth), depending on whether we want only the current section with all subsections or sub-subsections, or referencing another part ... Maybe you have some suggestions on how to make this "mostly" general? However, we will have to think about this, and maybe come up with a solution by the end of next week ...

  2. eguvep commented on Sep 16, 2025

    @eguvep
    Author

    Thanks a lot for the quick and positive response!
    There are a couple of minitoc packages for LaTeX (minitoc, aeb-minitoc, etoc, ...). I am not sure, if they may serve as a template. The existence of these packages may rather underline a general demand.

    The most general way would be the one, you suggested, I guess. Thus:

    @mini-toc(start, depth)
    

    with start=auto (the actual level) and depth=1 being good default values.

    But to be honest, I would just keep it simple:

    @mini-toc(depth)
    

    with depth=1 as a default.

    I can not really think of good use cases, where you would like to start further upwards?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions