Whenever possible I prefer to write literate programs. My go to tool for doing this is Emacs' org-mode and org-babel.
Combine, org-mode and org-babel allow me to write plaintext documents with embedded code snippets. When properly configured, org-babel allows these code snippets to be run directly from within the document.
Here is a simple script to convert my wiki.org file into html using pandoc.
pandoc wiki.org -o index.html
I am able to run that snippet directly from within my wiki.org file to create an html version of the same file. A slightly more verbose version of this same snippet is used to generate this webpage. That script appears above, under the heading "Emet."
The first line declares a code block, and defines the language org-babel should use for highlighting and running the snippet.
The third bit is different from language to language, here it is a file path.
#+BEGIN_SRC shell ~/Playground/org-wiki
The next bit is the code itself, and the closing bit simply ends the code block.
For more info on org-babel check out these webpages: