You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

36 lines
869 B

  1. package sanitized_anchor_name_test
  2. import (
  3. "fmt"
  4. "github.com/shurcooL/sanitized_anchor_name"
  5. )
  6. func ExampleCreate() {
  7. anchorName := sanitized_anchor_name.Create("This is a header")
  8. fmt.Println(anchorName)
  9. // Output:
  10. // this-is-a-header
  11. }
  12. func ExampleCreate_two() {
  13. fmt.Println(sanitized_anchor_name.Create("This is a header"))
  14. fmt.Println(sanitized_anchor_name.Create("This is also a header"))
  15. fmt.Println(sanitized_anchor_name.Create("main.go"))
  16. fmt.Println(sanitized_anchor_name.Create("Article 123"))
  17. fmt.Println(sanitized_anchor_name.Create("<- Let's try this, shall we?"))
  18. fmt.Printf("%q\n", sanitized_anchor_name.Create(" "))
  19. fmt.Println(sanitized_anchor_name.Create("Hello, 世界"))
  20. // Output:
  21. // this-is-a-header
  22. // this-is-also-a-header
  23. // main-go
  24. // article-123
  25. // let-s-try-this-shall-we
  26. // ""
  27. // hello-世界
  28. }