Browse Source

Add clickable anchors to docs headers

Closes #434
main
Cheng Lou 11 years ago
committed by Paul O’Shannessy
parent
commit
9c6d46bb14
  1. 10
      _css/react.scss
  2. 2
      _plugins/header_links.rb

10
_css/react.scss

@ -391,6 +391,16 @@ section.black content {
font-size: 24px;
}
h1, h2, h3, h4, h5, h6 {
a {
color: $darkTextColor;
&:hover {
text-decoration: underline;
}
}
}
// H2s form documentation topic dividers. Extra space helps.
h2 {
margin-top: 30px;

2
_plugins/header_links.rb

@ -11,7 +11,7 @@ class Redcarpet::Render::HTML
.gsub(/\s+/, "-")
.gsub(/[^A-Za-z0-9\-_.]/, "")
return "<h#{level} id=\"#{clean_title}\">#{title}</h#{level}>"
return "<h#{level} id=\"#{clean_title}\"><a href=\"##{clean_title}\">#{title}</a></h#{level}>"
end
end

Loading…
Cancel
Save