Merge pull request #539 from spicyj/doc-anchors-again

Make doc headers clickable again
This commit is contained in:
Paul O’Shannessy 2013-11-18 17:45:39 -08:00
commit e79079d174
2 changed files with 12 additions and 14 deletions

View File

@ -77,20 +77,18 @@ li {
// Make header navigation linkable and on the screen. Used in documentation and
// blog posts.
h1, h2, h3, h4, h5, h6 {
&.anchor {
position: relative;
top: -$navHeight;
z-index: -1;
> a {
color: $darkTextColor;
position: relative;
top: $navHeight;
&:hover {
text-decoration: underline;
}
}
.anchor {
margin-top: -$navHeight;
position: absolute;
}
&:hover .hash-link {
display: inline;
}
}
.hash-link {
color: $mediumTextColor;
display: none;
}
// Main Nav

View File

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