Skip to content

Commit

Permalink
if there are no \!SLIDE markers in the markdown file, then make every…
Browse files Browse the repository at this point in the history
… H1 define a new slide
  • Loading branch information
alexch committed Apr 27, 2011
1 parent 382f345 commit 4446c9b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/showoff.rb
Expand Up @@ -81,6 +81,12 @@ def preshow_files
end end


def process_markdown(name, content, static=false, pdf=false) 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/) slides = content.split(/^<?!SLIDE/)
slides.delete('') slides.delete('')
final = '' final = ''
Expand Down

3 comments on commit 4446c9b

@davetron5000
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@alexch
Copy link
Owner Author

@alexch alexch commented on 4446c9b May 10, 2011

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Owner Author

@alexch alexch commented on 4446c9b May 23, 2011

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.