I wasted so much time on this that I decided that it is worthing a gist.
The Markdown PDF VS-code extension is using the puppeteer engine to render PDF. Setting up nice header and footer is not easy and we cannot get access to the temporary html that the engine is rendering.
In this gist:
- a CSS file that formats tables as grids, as expected by many technical documents.