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.

README.md 957 B

1234567891011121314151617181920212223242526272829
  1. # Snipdoc
  2. Snipdoc is a simple tool for maintaining package documentation that contains
  3. code samples.
  4. 1. Create a subdirectory of your package to hold the following files. "internal"
  5. is a good name.
  6. 2. Write a template file (for example, "doc.template") with the text of your package documentation. The file
  7. should look exactly like you want your doc.go file to look, except for code
  8. snippets.
  9. Instead of embedding a code snippet, write a line consisting solely of
  10. [NAME]
  11. for your choice of NAME.
  12. 3. Write a snippets file (for example, "doc-snippets.go") as a valid Go source
  13. file. Begin each snippet you'd like to appear in your package docs with
  14. `//[ NAME` and end it with `//]`.
  15. 4. Construct your doc.go file with the command
  16. ```
  17. awk -f snipdoc.awk doc-snippets.go doc.template
  18. ```
  19. The file "sample-makefile" in this directory verifies that the
  20. snippets file compiles and safely constructs a doc.go file.