Browse files

if there are no \!SLIDE markers in the markdown file, then make every…

… H1 define a new slide
  • Loading branch information...
1 parent 382f345 commit 4446c9b82a42fe57b9d27d017f0a2c0848e25c89 @alexch committed Apr 27, 2011
Showing with 6 additions and 0 deletions.
  1. +6 −0 lib/showoff.rb
@@ -81,6 +81,12 @@ def preshow_files
def process_markdown(name, content, static=false, pdf=false)
+ # if there are no !SLIDE markers, then make every H1 define a new slide
+ unless content =~ /^\<?!SLIDE/m
+ content = content.gsub(/^# /m, "<!SLIDE bullets>\n# ")
+ end
slides = content.split(/^<?!SLIDE/)
final = ''

3 comments on commit 4446c9b

+1, this is awesome. I have typed :1,$s/^#/<!SLIDE>^V^M/g so many times in vi…


alexch replied May 10, 2011

There should also be "showoff slidify" which does that and saves it, but this is good to bootstrap an existing Markdown file. (Suggestions welcome for a better command name :-))


alexch replied May 23, 2011

btw, my fork now has code that makes all H1s create a new slide (unless they're the first thing on a slide) --
see c8f9451 and c84e41f
(or wait for me to get around to making a proper pull request)

Please sign in to comment.