Whenever I use --
to generate incremental slides. Sometimes it works but sometimes not.
For example, the following codes work different way. It seems --
works in very random way. I was wondering if there's suggested way to use this sign.
blah blah
--
blah blah
or
blah blah
--
blah blah
It's not random and the issue you are having is actually how markdown works and has nothing to do with --
. So which one you should use depends on what you want to do. But mostly people want to show list items incrementally and in that case, you have to use the 2nd approach i.e. use space before and after --
The first thing we need to understand is that --
simply put the contents written after this in the next slide. It's simple as that.
So if we write the text in markdown in such a way that it will continue to be on the same line, then using --
, the texts will continue to be in the same line in the next slide, and if we write text in markdown in a way that text will be in a separate line, then using --
will have the same effect, but text written after --
will be in the next slide.
To make this clear with an example, say I have written text like this (notice no space between the lines)
blah blah
foo bar
They will be rendered in the same line (due to no space) like this,
blah blah foo bar
So if I use --
in this case between these two line like this,
blah blah
--
foo bar
So in the first slide, we will have
blah blah
and in the second slide
blah blahfoo bar
That is, in the next slide, the text continues to be on the same line. Also, note that there's no space between blah blah
and foo bar
. To create a gap,
we have to give one space before or after --
. So as either,
blah blah
--
foo bar
or
blah blah
--
foo bar
In both cases, the text on 1st slide will be blah blah and 2nd slide blah blah foo bar. So in the case of incremental slides, a single space between two lines of text amounts to a space between the words in the same line.
Now in markdown, to create write text on a new line you have to use a space explicitly. So
blah blah
foo bar
will be rendered as two separate lines
blah blah
foo bar
So similarly, while creating incremental slides, you have to give at least two spaces in total between the texts. So,
blah blah
--
foo bar
or
blah blah
--
foo bar
or
blah blah
--
foo bar
all three approaches create on the 1st slide,
blah blah
and on the 2nd slide,
blah blah
foo bar
Hope I haven't created more confusion instead of making things clear.