Skip to content

Vertical slide support

I was wondering whether you would not be interested in adding support for vertical slides? I think that it is great feature of reveal.js. I guess the diff below could serve as a starting point (or even final version after some polishing e.g. separator agreement, etc.) and could be added into the main repo.

diff --git a/mdslides/__main__.py b/mdslides/__main__.py
index b687cd04..664258d8 100755
--- a/mdslides/__main__.py
+++ b/mdslides/__main__.py
@@ -59,6 +59,7 @@ def main():
 
     title_template = "<title>{}</title>"
     section_template = "<section data-markdown {}><textarea data-template>\n{}\n</textarea></section>"
+    vertical_section_template = "<section>\n{}\n</section>"
     theme_template = '<link rel="stylesheet" href="dist/theme/{}.css" id="theme">'
     code_theme_template = '<link rel="stylesheet" href="plugin/highlight/{}.css" id="highlight-theme">'
 
@@ -66,6 +67,8 @@ def main():
     option_re = re.compile(option_re)
     delimiter_re = r"\[comment\]: # \(\!\!\![ ]*(.*)\)"
     delimiter_re = re.compile(delimiter_re)
+    vertical_delimiter_re = r"\[comment\]: # \(\|\|\|[ ]*(.*)\)"
+    vertical_delimiter_re = re.compile(vertical_delimiter_re)
     theme_re = r"\[comment\]: # \([ ]*THEME[ ]*=[ ]*(\S+)[ ]*\)"
     theme_re = re.compile(theme_re)
     code_theme_re = r"\[comment\]: # \([ ]*CODE_THEME[ ]*=[ ]*(\S+)[ ]*\)"
@@ -88,6 +91,7 @@ def main():
     # Build presentation
     presentation = list()
     slide = list()
+    vertical_slide = list()
     options = ["{} : {},".format(key, val)
                for key, val in default_options.items()]
     theme = default_theme
@@ -107,9 +111,25 @@ def main():
         m = delimiter_re.match(line)
         if m is not None:
             attributes = default_attributes + " " + m.group(1)
-            presentation.append(
-                    section_template.format(attributes, "\n".join(slide))
+            if vertical_slide:
+                presentation.append(
+                    vertical_section_template.format("\n".join(vertical_slide))
                 )
+                vertical_slide = list()
+            else:
+                presentation.append(
+                        section_template.format(attributes, "\n".join(slide))
+                    )
+            slide = list()
+            continue
+
+        # Is the line a vertical slide break?
+        m = vertical_delimiter_re.match(line)
+        if m is not None:
+            attributes = default_attributes + " " + m.group(1)
+            vertical_slide.append(
+                section_template.format(attributes, "\n".join(slide))
+            )
             slide = list()
             continue