md-to-pdf
md-to-pdf copied to clipboard
feature: Allow use of markdown-it as the markdown parser
Problem:
Marked is a fine markdown parser, but markdown-it is the parser used by Visual Studio Code, so there's a much larger number of plugins available.
When authoring markdown using Visual Studio Code, rendering using markdown-it would allow the preview to be a close approximation for the output pdf.
Solution:
- Add options for markdown-it in
BasicConfig
:
markdown_parser: 'marked' | 'markdown-it';
markdown_it_options: MarkdownIt.Options;
markdown_it_plugins: MarkdownIt.PluginSimple[];
- Add a new file
get-markdown-it-with-highlighter.ts
that returns a markdown-it instance that is roughly comparable to the default marked instance. Call this from getHtml when configured with markdown-it. - Add required plumbing, tests and examples for how to use markdown-it extensions.