Skip to content
This repository has been archived by the owner on Dec 19, 2017. It is now read-only.

Commit

Permalink
Use - for Markdown slugs instead of _ (realm#524)
Browse files Browse the repository at this point in the history
  • Loading branch information
zwaldowski committed Apr 14, 2016
1 parent 9eff21d commit eaa6fd2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## Master

##### Bug Fixes

* Uses GitHub-Flavored Markdown syntax for anchors when rendering README pages.
[Zachary Waldowski](https://github.com/zwaldowski)
[#524](https://github.com/realm/jazzy/issues/524)

## 0.6.0

##### Breaking
Expand Down
6 changes: 3 additions & 3 deletions lib/jazzy/jazzy_markdown.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ class JazzyHTML < Redcarpet::Render::HTML
include Rouge::Plugins::Redcarpet

def header(text, header_level)
text_slug = text.gsub(/[^a-zA-Z0-9]+/, '_')
text_slug = text.gsub(/[^\w]+/, '-')
.downcase
.sub(/^_/, '')
.sub(/_$/, '')
.sub(/^-/, '')
.sub(/-$/, '')

"<a href='##{text_slug}' class='anchor' aria-hidden=true>" \
'<span class="header-anchor"></span>' \
Expand Down

0 comments on commit eaa6fd2

Please sign in to comment.