The previous article about IDLdoc showed how to get and run IDLdoc on your library without changing any of your code. Now, what if you are willing to add special tags to your comments for IDLdoc’s use?

So here is just the header of the MG_N_SMALLEST routine with a few of the most common tags in the comments:

;+
; Finds the n smallest elements of a data array. This algorithm works
; fastest on uniformly distributed data. The worst case for it is a
; single smallest data element and all other elements with another
; value. This will be nearly equivalent to just sorting all the
; elements and choosing the first n elements.
;
; @returns index array
;
; @param data {in}{required}{type=numeric array} data array of any
;        numeric type (except complex/dcomplex)
; @param n {in}{required}{type=integer} number of smallest elements
;        to find
; @keyword largest {in}{optional}{type=boolean} set to find n largest
;          elements
;-
function mg_n_smallest, data, n, largest=largest