-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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