Add optional title attribute to the code examples

1. Add optional title attribute to the code examples
2. Let the show_in_doc and title keys survive example regeneration (with added config flag)

Let me know if there are any changes you need before you can merge this.