Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-docs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorConnor Shea <connor.james.shea@gmail.com>2016-11-23 01:46:54 +0300
committerConnor Shea <connor.james.shea@gmail.com>2016-11-23 01:59:23 +0300
commitb43087fb68934db1c9f992b9d580562742ef7dc0 (patch)
tree0ec542b39d62c665b58b80371d160f3fbcc2d2fc /lib
parentbe91e30adaabd1312395d1a03d4ac02e960a83bb (diff)
Add anchor links to all headers.
Diffstat (limited to 'lib')
-rw-r--r--lib/helpers_.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/helpers_.rb b/lib/helpers_.rb
index 589df4b7..7fa9d11f 100644
--- a/lib/helpers_.rb
+++ b/lib/helpers_.rb
@@ -9,4 +9,10 @@ require 'rouge/plugins/redcarpet'
class HTML < Redcarpet::Render::HTML
include Rouge::Plugins::Redcarpet
+
+ def header(text, header_level)
+ anchor = text.downcase.strip.split(" ").join("-")
+
+ "<h#{header_level} id='#{anchor}'>#{text} <a class='anchor' href='##{anchor}' title='Permalink'>&para;</a></h#{header_level}>"
+ end
end