Skip to content

Instantly share code, notes, and snippets.



Created Jun 4, 2014
What would you like to do?
require 'redcarpet'
desc "generate index.html from"
file "index.html" => "" do |task|
puts "Processing to generate a new index.html..."
# `r` means we're using the "read" mode with the file
# we need a String for Redcarpet, it doesn't accept File objects.
string =, 'r') { |file| }
markdown =, extensions = {})
rendered_markdown = markdown.render(string)
html_output = template { rendered_markdown }, 'w') { |file| file.write(html_output) }
puts "All done!"
def template(&block)
<<-HTML.gsub /^\s+/, ""
<title>Keep a Changelog</title>
<link rel="stylesheet" href="assets/stylesheets/normalize.css" media="screen" charset="utf-8">
<link rel="stylesheet" href="assets/stylesheets/style.css" media="screen" charset="utf-8">
<script type="text/javascript" src="//"></script>
<script type="text/javascript">try{Typekit.load();}catch(e){}</script>
<footer class="clearfix">
<p class="license">This project is <a href="">MIT Licensed</a>.</p>
<p class="about"><a href="">Typed</a> with trepidation by <a href="">Olivier Lacan</a> from <a href="">Code School</a>.</p>
<script type="text/javascript">
var _gauges = _gauges || [];
(function() {
var t = document.createElement('script');
t.type = 'text/javascript';
t.async = true; = 'gauges-tracker';
t.setAttribute('data-site-id', '5389808eeddd5b055a00440d');
t.src = '//';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(t, s);

This comment has been minimized.

Copy link
Owner Author

@jswanner jswanner commented Jun 4, 2014

Also,, 'r') { |file| }
# ..., 'w') { |file| file.write(html_output) }

can be change to:
# ...
File.write(, html_output)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment