converter.go 645 B

123456789101112131415161718192021222324252627
  1. // Package markdown defines the name, signature and default implementation of
  2. // the Markdown conversion procedure.
  3. package markdown
  4. import (
  5. "io"
  6. "github.com/yuin/goldmark"
  7. )
  8. // ToHTML is the default Markdown conversion procedure.
  9. //
  10. // It can be swapped with any other conversion procedure with the same
  11. // signature. This allows the use of other Markdown conversion libraries.
  12. //
  13. // Changing the conversion procedure should be done as early as possible in the
  14. // main program.
  15. var ToHTML func([]byte, io.Writer) error
  16. func init() {
  17. gm := goldmark.New()
  18. ToHTML = func(buf []byte, w io.Writer) error {
  19. return gm.Convert(buf, w)
  20. }
  21. }