Getting started creating nbconvert templates

You may be interested in how the hide_code extension handles some of the related steps.

Is this just meant as a way to learn to use nbconvert? Because for your example I’d just use nbformat to take the output from code source that includes display(Markdown() and make it a markdown cell. (You can use this script as a backbone for modification if it helps.) But maybe you are trying to do this all with one step and nbconvert would allow the flexibility you need?