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

Mandatory --section-divs behaviour with revealjs #9592

Open
multimeric opened this issue Mar 20, 2024 · 5 comments
Open

Mandatory --section-divs behaviour with revealjs #9592

multimeric opened this issue Mar 20, 2024 · 5 comments
Labels

Comments

@multimeric
Copy link

Explain the problem.
Consider the following markdown document. Here, we have an HTML class we want to apply to the title of the slide, but not to the content.

# Title {.my-title-class}

Here is some content

However, when running pandoc -i test.md --to revealjs on this document, we get the following. Note how
my-title-class is attached to the <section> as well as the <h1>, which is not what we wanted:

<section id="title" class="slide level1 my-title-class">
<h1 class="my-title-class">Title</h1>
<p>Here is some content</p>
</section>

Compare this to the standard HTML behaviour. pandoc -i test.md --to html gives us the following, which is correct because only the <h1> has the class:

<h1 class="my-title-class" id="title">Title</h1>
<p>Here is some content</p>

But now, if we add --section-divs, we get something suspiciously similar to the revealjs result:

<section id="title" class="level1 my-title-class">
<h1 class="my-title-class">Title</h1>
<p>Here is some content</p>
</section>

Consequently, I wonder if there is a mandatory --section-divs behaviour with revealjs, which in my case is very irritating, because I don't want the class applied this way. It's possible that this is necessary because of how revealjs expects its HTML markup, and if that is the case, I would love to be able to have a flag that enables section-divs, but without copying the header classes onto the sections!

Pandoc version?

pandoc 3.1.12.1
Features: +server +lua
Scripting engine: Lua 5.4
macOS: 12.6
@multimeric multimeric added the bug label Mar 20, 2024
@jgm
Copy link
Owner

jgm commented Mar 20, 2024

I wonder if there is a mandatory --section-divs behaviour with revealjs,

Yes, because revealjs requires these sections.

@jgm
Copy link
Owner

jgm commented Mar 20, 2024

I do understand that this behavior is problematic for some uses (e.g. applying tailwind css classes). However, other people rely on it; when I reverted it at one point, it caused problems.
See #5975
and especially #5965

@multimeric
Copy link
Author

Thanks for the background.

Could we have a --copy-header-attribs false type flag to make this opt out without breaking existing behaviour?

@jgm
Copy link
Owner

jgm commented Mar 20, 2024

In principle this is possible, but it's an ugly solution. This would mean you wouldn't get any attributes on the section, not even an identifier. In revealjs many features of slides are controlled by attributes on the section element, so you'd lose the ability to use any of these.

@multimeric
Copy link
Author

Okay, how about a --manual-slides flag which disables all the automatic slide splitting (by headings, and by ---), and disables the --section-divs behaviour, and instead requires the user to use a ::: Slide class to distinguish each slide? Then they can add attributes to the heading using # Title {.my-title-class}, and attributes to the slide using ::: {.slide .my-section-class}.

As someone who wants control rather than convenience for this particular use case, I think this would be great.

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

No branches or pull requests

2 participants