Skip to content

Latest commit

 

History

History
44 lines (21 loc) · 1.03 KB

README.md

File metadata and controls

44 lines (21 loc) · 1.03 KB

Comment Book

Comment Book extracts the comments from your code and converts them to Markdown.

To use it, copy comment-book.py into your repo and run:

python comment-book.py

The Markdown file can be converted to icml, a format that InDesign will consume for styling and layout. To do this, first download pandoc. Then run

pandoc -s -f markdown -t icml -o my-book.icml my-book.md

The provided python file will probably need some tweaking for your repo's tastes. For example, you might have to add a case to the switch statement that checks a file's extension and applies the revelant regexes.

Regexes Used

These aren't always perfect - one major problem is that they don't check if they are part of a string. But they get the job done. Pull requests welcome!

// comment

(?<!http:)\/\/.*\n

/* comment */

\/\*.*?\*\/

<!-- comment -->

\<!--.*?--\>

{* comment *}

{\*.*?\*}

# comment

#.*\n

''' comment '''

'''.*?'''