You already have the first bullet point implemented. The generate channel in the main process watches the messages and invokes the generateHTML function in case the format parameter has an html value.
All we need to do now is save the markdown context in a temporary location.