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

No slide notes on a title slide in reveal.js #5237

Closed
jaen opened this issue Jan 20, 2019 · 7 comments
Closed

No slide notes on a title slide in reveal.js #5237

jaen opened this issue Jan 20, 2019 · 7 comments

Comments

@jaen
Copy link

jaen commented Jan 20, 2019

Issues #3993 and #1618 describe issues with speaker notes on title slides. As mentioned in #3993 --slide-level=2 solves the issue with speaker note breaking header level recognition, but the notes themselves don't appear in the output document on the title slide. As far as I understand this was done in the name of uniformity between different presentation output formats, but this makes for a somewhat awkward situation where you can't leave any tips for yourself on the title slide.

Is there anything that can be done to get slide notes on title slides save for manually adjusting slides afterwards?

@jgm
Copy link
Owner

jgm commented Jan 21, 2019 via email

@jaen
Copy link
Author

jaen commented Jan 22, 2019

They don't seem to appear at all. For example this Pandoc markdown document:

# Main header

::: notes
Main header notes
:::

## Subheader 1

::: notes
Subheader 1 notes
:::

## Subheader 2

::: notes
Subheader  notes
:::

when rendered with --slide-level=2 -t revealjs produces the following:

<section>
    <section id="main-header" class="title-slide slide level1">
        <h1>Main header</h1>
        <!-- notes missing here -->
    </section>
    <section id="subheader-1" class="slide level2">
        <h2>Subheader 1</h2>
        <aside class="notes">
            <p>Subheader 1 notes</p>
        </aside>
    </section>
    <section id="subheader-2" class="slide level2">
        <h2>Subheader 2</h2>
        <aside class="notes">
            <p>Subheader notes</p>
        </aside>
    </section>
</section>

where I would have expected something like this instead:

<section>
    <section id="main-header" class="title-slide slide level1">
        <h1>Main header</h1>
        <aside class="notes">
            <p>Main header notes</p>
        </aside>
    </section>
    <section id="subheader-1" class="slide level2">
        <h2>Subheader 1</h2>
        <aside class="notes">
            <p>Subheader 1 notes</p>
        </aside>
    </section>
    <section id="subheader-2" class="slide level2">
        <h2>Subheader 2</h2>
        <aside class="notes">
            <p>Subheader notes</p>
        </aside>
    </section>
</section>

Trying to work around this by using HTML doesn't work either – it seems Pandoc throws any content on the title slide away.

@edi9999
Copy link

edi9999 commented Feb 12, 2019

Same issue for me, notes do not appear in title slides. (pandoc 2.6)

@jgm jgm added this to the pandoc-2.7 milestone Feb 12, 2019
jgm added a commit that referenced this issue Mar 2, 2019
This facilitates real 2D revealjs slideshows, with
content under the top-level slide in each stack.
It also enables notes on title slides.

Closes #4317 and #5237.
@jgm jgm closed this as completed Mar 2, 2019
@lassepe
Copy link

lassepe commented Jan 24, 2020

I am somewhat confused by the title of this issue and the fact that it is closed. This discussion only referred to "level-1" slides, right? Or does the fix in 5990f14 also allow to places speaker notes on the title slide (the very first slide that is essentially generated from the yaml header data title, subtitle, author, etc.? If so, where to add speaker notes for the title slide? Is there a yaml header field for this?

@jgm
Copy link
Owner

jgm commented Jan 24, 2020

"Title slides" may be a bit confusing; it refers to the slides that just contain the section headings at the top of 2D columns. I don't know if there's a way to do speaker notes on the title of the slide show.

@fkohrt
Copy link
Contributor

fkohrt commented Mar 22, 2021

I don't know if there's a way to do speaker notes on the title of the slide show.

@lassepe @jgm In case you are interested, this is indeed possible using Pandoc's title-slide-attributes in combination with Reveal.js' data-notes. For example, to add the equivalent of the following markdown as speaker notes on the very first slide of your presentation...

__Why does the sigla frequently overfesk the trelsum?__

- All siglas are mellious.
- Siglas are always votial.
- The trelsum is usually tarious.
- No trelsa are directly feskable.

...add the following to your preamble:

title-slide-attributes:
  data-notes: '&lt;p&gt;&lt;strong&gt;Why does the sigla frequently overfesk the trelsum?&lt;/strong&gt;&lt;/p&gt;&lt;ul&gt;&lt;li class=&apos;fragment&apos;&gt;All siglas are mellious.&lt;/li&gt;&lt;li class=&apos;fragment&apos;&gt;Siglas are always votial.&lt;/li&gt;&lt;li class=&apos;fragment&apos;&gt;The trelsum is usually tarious.&lt;/li&gt;&lt;li class=&apos;fragment&apos;&gt;No trelsa are directly feskable.&lt;/li&gt;&lt;/ul&gt;'

It's a bit fiddly as you have to manually convert the Markdown above into HTML and then substitute

  • &&amp;
  • <&lt;
  • >&gt;
  • "&apos;

Finally, wrap everything into single quotation marks (') – and don't use them elsewhere.

@stoufa
Copy link

stoufa commented Oct 20, 2022

@fkohrt's approach worked for me - at first - but then the notes on the title slide disappeared. I'm not sure what has happened since then. However, to fix this, I used a quick and dirty method, which I'm sharing here as a temporary workaround.

I added the following <script> element before </body> using the --include-after-body=footer.html argument in pandoc, this snippet creates an aside.notes element inside the #title-slide element and set its content to the value in the data-notes attribute.

<!-- footer.html -->

<script>
  /**
   * @param {String} HTML representing a single element
   * @return {Element}
   */
  function htmlToElement(html) {
    var template = document.createElement('template');
    html = html.trim(); // Never return a text node of whitespace as the result
    template.innerHTML = html;
    return template.content.firstChild;
  }

  const title_slide = document.querySelector('#title-slide');
  let data_notes = title_slide.getAttribute('data-notes');
  data_notes = data_notes ? data_notes : ''; // replace data_notes with an empty string if it's null
  const html_template = `<aside class="notes">${data_notes}</aside>`;
  const notes_dom_object = htmlToElement(html_template);
  title_slide.appendChild(notes_dom_object);
</script>

<!--
I found the function htmlToElement(HTML) in the following StackOverflow thread:
stackoverflow.com/questions/494143/creating-a-new-dom-element-from-an-html-string-using-built-in-dom-methods-or-pro
-->

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

No branches or pull requests

6 participants