Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Hide chapters in navigation/menu #120

Open
rfuehrer opened this issue Feb 19, 2023 · 3 comments
Open

[Feature] Hide chapters in navigation/menu #120

rfuehrer opened this issue Feb 19, 2023 · 3 comments

Comments

@rfuehrer
Copy link

rfuehrer commented Feb 19, 2023

A chapter hiding feature allows the navigation menu to be displayed more compactly and chapters and subchapters to be reached using only forward or back navigation.

The option of hidden is not sufficient for this, because a complete block with subchapters is hidden in the navigation, but also skipped completely. In contrast, the feature only shows the hiding in the navigation.

Possible use:
Such a feature can be used, for example, to create quizzes where the questions are displayed on individual pages/chapters, but they are not directly accessible via the navigation/menu.

Possible solution:
Basically, it probably only needs an option to omit the following heading (regardless of hierarchy) from the navigation generation. However, this feature would have to affect all subordinate hierarchies to remain consistent.

Development Opportunity:
Should there be another feature in perspective, that next chapters/slides can only be called if the quiz located on a page has been successfully solved or uncovered, a test could be created over it, which must be compellingly sequentially executed. However, since the minimum score also applies to tests, this currently seems sufficient.

31597

@andre-dietrich
Copy link
Member

For now, here is maybe a simple workaround:

<!--

@onload

// hide the entire table of contents
//
// const slide = document.body.children[0]
// slide.style.left = "0px"
// slide.style.width = "100%"
// document.getElementById("lia-toc").style.display = "none"
// document.getElementById("lia-btn-toc").style.display = "none"
// document.getElementById("lia-toolbar-nav").style.left = "0px"

// hide only the toc elements by section id
const slides = [2,3,4,7]
const query = slides.map((id) => `a[href*="#${id}"]`).join(", ")
const links = document.getElementById("lia-toc").querySelectorAll(query);
// Iterate through the selected links and hide them
links.forEach(link => {
  link.style.display = 'none';
});

@end

-->

# Some course

The onload macro can be used at initialization, similar to onload in HTML it will be loaded only once. This can be used do any kind of initialization. Within the example a querySelector is generated, that matches the #id hrefs and it should only be applied onto the toc-element ...

The other example above can be used to hide the entire table-of-contents ... I did not get the question correct at a first glance ...

@rfuehrer
Copy link
Author

jepp, funktioniert. Bei der Einbindung mehr man aber, dass das Script nach dem ersten Painting angewendet wird, wenn die Nodes bereits existieren. Dadurch sieht man die Nodes kurzzeitig, bis diese dann ausgeblendet werden. Aber für einen ersten Workaround schon cool.

@andre-dietrich
Copy link
Member

Ja leider, das Script wird erst ausgeführt, wenn etwas dargestellt wurde und nachdem, vielleicht noch zusätzliche JavaScript Bibliotheken geladen wurden, die in onload benötigt werden ...

Hier vielleicht ein Wörkaround ohne Glitch:

### <span>Title on GitHub</span><!-- style="display: none; height:0px" -->

<!-- style="display:block" -->
<h2 style="display:none">Title in LiaScript</h2>

Der originale Titel wird durch den angehängten Kommentar in LiaScript nicht angezeigt, bzw nur sehr klein. Der Kommentar setzt das Styling im original-Title in LiaScript. Umgekehrt im zweiten Titel, der sollte auf GitHub nicht erscheinen, da hier nur der tag aber nicht der Kommentar interpretiert werden ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants