Search code examples
commentsmarkdowndocumentation-generationpandoccode-documentation

Use pandoc as documentation generator


I saw in a wikipedia page (Comparison of documentation generators) that pandoc can be used as a Documentation Generator (like doxygen does).

But I didn't find in pandoc's documentation or in it's site a way to extract documentation from source code comments, as others documentation generator does.

So how can I use pandoc to do this? There is a way to extract pandoc's markup language from code comments and create a PDF or HTML document from it? Or the wikipedia's comparison list is wrong?


Solution

  • Taking the method described in http://www.ucalgary.ca/rzach/blog/2014/05/simple-way-to-document-code-with-markdown-grep-and-pandoc.html as mb21 mentions a bash script like the one below does the job

    "makedoc"
    
    #!/bin/bash
    
    grep -e "^%" -e "^$$" $1.tex | cut --bytes=3-| pandoc -f markdown  -o $1.pdf