Hide Code for Documentation Example
This page shows a setup for code documentation that I have developed. Feel free to use as you wish, no restrictions.
Using this is as simple as replacing "getSomeInfo" with the name of your function, in all 4 spots (h3 id, button id, show parameter, pre id), and then replacing these descriptions, the pseudocode, and the actual code with your own info. Code Details down there starts out with some pseudocode describing how the function does what it does, and immediately after that is the actual listing of the code, which will generally be longer and therefore hidden.
I have also been very specific in my CSS, using the headers to define sections visually. I have HTML comments marking the different sections in the page source as well, to aid in maintaining the listing as you look for the function that was changed. Also note that I have used the <code> tag to mark variables wherever they are used (outside the actual code listing), and this helps to differentiate to the reader the times you are talking about the concept as versus when you are talking about the variable (especially useful in modern programming with descriptive variable names). There are also some <span> tags in the actual code listing for doing some mock syntax highlighting, if you feel up to the task.
Main Code
Public Function getSomeInfo
Takes: aParameter
as string
Returns: String
Local Variables: myTempArray
as Variant, myResultString
as String
Description:
This is simply for returning the first and last word in a string, purely as an example.
Code Details:
- Takes
aParameter
and splits it into arraymyTempArray
. - Puts just the first and last tokens into
myResultString
. - Returns
myResultString
Public Function getSomeInfo (aParameter as String) as String 'Visual Basic function to return the first and last words of a string Dim myTempArray as Variant, myResultString as String myTempArray = Split(aParameter, " ") myResultString = myTempArray(0) & ", " & myTempArray(UBound(myTempArray)) getSomeInfo = myResultString End Function
Public Function yourFunction
Takes: nothing
Returns: nothing
Local Variables: none
Description:
Lorem ipsum, et al.
Code Details:
- Get going
- Do it to it
- ????
- Profit!
All your base are blong to us.