commit | 86672fcb3f950f35f2e675df2240550f2a50762f | [log] [tgz] |
---|---|---|
author | Dmitri Shuralyov <shurcooL@gmail.com> | Tue Sep 05 02:47:45 2017 |
committer | Dmitri Shuralyov <shurcooL@gmail.com> | Mon Sep 18 18:10:15 2017 |
tree | 91ffbf6de84fbeccc63b3e5625871b9ee2a99f26 | |
parent | 541ff5ee47f1dddf6a5281af78307d921524bcb5 [diff] |
Simplify range over runes. There's no behavior change. This is equivalent code, but simpler and more efficient.
Package sanitized_anchor_name provides a func to create sanitized anchor names.
Its logic can be reused by multiple packages to create interoperable anchor names and links to those anchors.
At this time, it does not try to ensure that generated anchor names are unique, that responsibility falls on the caller.
go get -u github.com/shurcooL/sanitized_anchor_name
anchorName := sanitized_anchor_name.Create("This is a header") fmt.Println(anchorName) // Output: // this-is-a-header