Documentation ¶
Overview ¶
Package sanitizedanchorname provides a func to create sanitized anchor names.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Create ¶
Create returns a sanitized anchor name for the given text.
Example ¶
package main import ( "fmt" "github.com/shurcooL/gtdo/internal/sanitizedanchorname" ) func main() { anchorName := sanitizedanchorname.Create("This is a header") fmt.Println(anchorName) }
Output: this-is-a-header
Example (Two) ¶
package main import ( "fmt" "github.com/shurcooL/gtdo/internal/sanitizedanchorname" ) func main() { fmt.Println(sanitizedanchorname.Create("This is a header")) fmt.Println(sanitizedanchorname.Create("This is also a header")) fmt.Println(sanitizedanchorname.Create("main.go")) fmt.Println(sanitizedanchorname.Create("Article 123")) fmt.Println(sanitizedanchorname.Create("<- Let's try this, shall we?")) fmt.Printf("%q\n", sanitizedanchorname.Create(" ")) fmt.Println(sanitizedanchorname.Create("Hello, 世界")) }
Output: this-is-a-header this-is-also-a-header main.go article-123 let-s-try-this-shall-we "" hello-世界
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.