0

I am using Slidify to create slides. My title is too long, so I want to break
line. However, I tried the pipe symbol, it didn't break line from "and". It showed /The Relationship between Motivation/and Learning Strategies on the 2012 PISA Math in the HTML output.

   ---
    title: |
        | The Relationship between Motivation 
        | and Learning Strategies on the 2012 PISA Math 
    subtitle    : LCA
    author      : Ali
    job         : Student 
    framework   : io2012        # {io2012, html5slides, shower, dzslides, ...}
    highlighter : highlight.js  # {highlight.js, prettify, highlight}
    hitheme     : tomorrow      # 
    widgets     : []            # {mathjax, quiz, bootstrap}
    mode        : selfcontained # {standalone, draft}
    knit        : slidify::knit2slides
    ---

1 Answers1

0

The problem is that the YAML header gets parsed into HTML, and in doing so sanitises all special characters. You've also mistaken "multiline YAML" (the pipe symbol) with "multiline header" (the output).

The pipe symbol will allow multiline YAML as in, you can write your one YAML over multiple lines. Compare:

title: |
  The Relationship between Motivation  
  and Learning Strategies on the 2012 PISA Math

and

title: The Relationship between Motivation and Learning Strategies on the 2012 PISA Math

If you check the resulting HTML, the former has the multiline in the source, but without a specific <br/ > tag, there will be no linebreak.

I've played around with tons of newlines, and I haven't found a way to stop pandoc from sanitising any special characters. You'll need something like the \protect{} command in LaTeX (this is your problem, but solved for LaTeX: In Pandoc, how do I add a newline between authors through the YAML metablock without modifying the template?)

You best/easiest bet is to open the HTML source code and add the <br/ > tag manually once everything is done. Search for the <h1>The Relationship ...</h1>tags in the file :(

Christoph Safferling
  • 1,116
  • 11
  • 10