reveal.js icon indicating copy to clipboard operation
reveal.js copied to clipboard

Markdown data-separator creating vertical slides instead of horizontal

Open nmanandhar opened this issue 4 years ago • 1 comments

I was trying to use the data-separator of the Markdown plugin to create new section for each h1 and h2 sections in the markdown. I ended up using the following regex data-separator="(^---|\n(?=#\s)|\n(?=##\s))". This uses forward lookup so that h1/h2 tags create a separate section but are not removed. This seems to work except that now I get vertical slides instead of horizontal

Looking at the code, it seems to me that a simple check could fix that

	function slidify( markdown, options ) {
			isHorizontal = horizontalSeparatorRegex.test( matches[0] ); 
                       //isHorizontal = !options.verticalSeparator || horizontalSeparatorRegex.test( matches[0] ); 

The benefit is that if verticalSeparator is not provided, we don't have to apply the regex and this might be more efficient.

nmanandhar avatar Dec 15 '21 05:12 nmanandhar

Sorry for necro but I wanna report that is still a problem.

I'm using these regex' for the seperators.

data-separator="^<!-- NEW SLIDE -->|\n(?=#\s)|\n(?=##\s)"
data-separator-vertical="^<!-- VSLIDE -->"

Interestingly, when I use <!-- NEW SLIDE --> to create a new slide, it actually makes a horizontal one. I also ran into a different problem when using ^## for the regex, where it would create a horizontal slide, but not format the header properly (it was a regular <p> and not a h2).

I'm not sure what causes this, headers seem definetly to handled different. For now I'm sticking to using <!-- NEW SLIDE -->, but I think it would be neat to use headers as well.

JulianGmp avatar Oct 14 '23 16:10 JulianGmp