Skip to content

Instantly share code, notes, and snippets.

@rdela
Forked from cowboy/runme.sh
Created April 5, 2012 21:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rdela/2314457 to your computer and use it in GitHub Desktop.
Save rdela/2314457 to your computer and use it in GitHub Desktop.
Linkify every H2+ in *.md MarkDown files with a ⚑ for GitHub-friendly deep-linking.
ruby -pi -e '$_.gsub!(/(##+)\s+(.*?)\s*\n/){a,b=$1,$2;name=b.downcase.gsub(/\W+/,"-").gsub(/^-|-$/,"");%{#{a} #{b} <a name="#{name}" href="##{name}" title="Link to this section">⚑</a>\n}}' *.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment