attakei / sphinx-revealjs

HTML Presentation builder for Pythonista
https://attakei.github.io/sphinx-revealjs/
Apache License 2.0
109 stars 19 forks source link

Hierarchy of sections not clear in generated HTML. Is there an unnecessary wrapping section? #174

Open achimwackerow opened 1 month ago

achimwackerow commented 1 month ago

What happened?

Why are the main sections wrapped in another section? Revealjs doesn't do this. This can cause issues for revealjs plugins.

The generated HTML of the sphinx-revealjs demo has following structure:

<body>
    <div class="reveal">
        <div class="slides" role="main">
            <section>
                <section>
                    <h1>Introduction of sphinx-revealjs</h1>
                </section>
            </section>
            <section>
                <section>
                    <h2>Overview</h2>
                </section>
                <section>
                    <h3>What is this?</h3>
...

It is not clear why each main section (like h1 and h2) are in a section which is in a section. One level of section seems to be enough. (Furthermore there is an unnecessary closing "" after "<script async". This might be caused by some issue in the Python code.)

The reveal.js demo barebones at https://github.com/hakimel/reveal.js/blob/master/examples/barebones.html has following structure:

<body>
    <div class="reveal">
        <div class="slides">
            <section>
                <h2>Barebones Presentation</h2>
                <p>This example contains the bare minimum includes and markup required to run a reveal.js presentation.</p>
            </section>
            <section>
                <h2>No Theme</h2>
...

This is a simpler structure which can be used successfully with the revealjs plugin simplemenu. An attribute "data-name" is specified to each main section. A menu of main sections can then automatically be generated.

This is not possible with an additional outer section (which is currently generated by sphinx-revealjs). The data-name would show up only in the inner section which is then ignored by the plugin.

For the demo of simplemenu see: https://github.com/Martinomagnifico/reveal.js-simplemenu/blob/master/demo.html in action: https://martinomagnifico.github.io/reveal.js-simplemenu/demo.html#/whatitdoes

Operating system

Windows 10

Python runtime and version

Python 3.12.4

Sphinx version

7.2.6

Library version

3.0.2

Extra context

Thank you for the version 3.

attakei commented 1 month ago

Why are the main sections wrapped in another section?

This is for "Vertical Slides" feature of revealjs. sphinx-revealjs defines and implements that h1 and h2 sections are top of vertical slides. And , it is generated nested sections everytimes for implementation simplify.

attakei commented 1 month ago

Please paste or share your reproduction code.

v3.0.x provides directives to inject attributes into per section elements. Therefore, I think that can do it in current version.

I need to see your code issued for this to judge where are there problems.

achimwackerow commented 1 month ago

I realized now that I wrongly placed the directive "revealjs-section". I corrected it and it works. The related fragment of conf.py, the rst file and a screenshot are attached. BTW the discussions link is broken. Is there a possibility to ask questions other than with github issues? Thanks again! conf.py.fragment.txt index.rst.txt example_screenshot

achimwackerow commented 1 month ago

Here are the files which combine the directives "revealjs-section" and "revealjs-vertical". index2.rst.txt example2_screenshot

attakei commented 1 month ago

I realized now that I wrongly placed the directive "revealjs-section". I corrected it and it works. The related fragment of conf.py, the rst file and a screenshot are attached.

Good! You can embed any revealjs plugins when using revealjs-section and revealjs-vertical properly.

BTW the discussions link is broken. Is there a possibility to ask questions other than with github issues?

I cloesed discussion pages once because questions are not much, but I missed to remove link for it. If you want to questions for it, use issue (it may reopen discussion, but it will be not now).