Skip to content

Markdown slides

markdownSlide { } accepts a Markdown string and hands it to reveal.js's Markdown plugin.

Basic usage

fun markdownBasic() {
  kslides {
    presentation {
      markdownSlide {
        content {
          """
          # Markdown slide
          Use a triple-quoted string.
          """
        }
      }
    }
  }
}

The triple-quoted string is trimIndent-ed for you, so indentation in your Kotlin source doesn't bleed into the rendered output.

Animated bullet points

Reveal.js's fragment classes work directly in Markdown via <!-- .element: ... --> comments:

fun markdownBullets() {
  kslides {
    presentation {
      markdownSlide {
        content {
          """
          # Animated bullets
          - First <!-- .element: class="fragment" -->
          - Second <!-- .element: class="fragment" -->
          - Third <!-- .element: class="fragment" -->
          """
        }
      }
    }
  }
}

Speaker notes

Anything after a line starting with Note: becomes speaker notes:

fun markdownWithNotes() {
  kslides {
    presentation {
      markdownSlide {
        content {
          """
          # Slide with speaker notes
          Press `S` during the presentation.

          Note: These speaker notes only show in the speaker view.
          """
        }
      }
    }
  }
}

Linkable slides

Set an id to link directly to a slide:

fun markdownWithId() {
  kslides {
    presentation {
      markdownSlide {
        id = "intro"
        content {
          """
          # The intro slide
          Linkable as `#/intro`.
          """
        }
      }
    }
  }
}

The slide is then reachable at /index.html#/intro.

Loading from a file

Prefer to keep long content out of your Kotlin source? See Including content.