simonhaenisch / md-to-pdf

Hackable CLI tool for converting Markdown files to PDF using Node.js and headless Chrome.
https://www.npmjs.com/md-to-pdf
MIT License
1.15k stars 110 forks source link

Improve documentation around Marked plugins #228

Open simonhaenisch opened 1 year ago

simonhaenisch commented 1 year ago

Problem:

A lot of functionality can be added to Marked's markdown parsing using plugins aka custom extensions. However the Marked docs are not very straightforward about extensibility in general.

Solution:

  1. Follow through with #140.
  2. Make it easy to inject custom extensions (both npm packages and local paths), maybe via string instead of having to pass a function which only works with .js config files (or maybe change the readme to suggest .js as the preferred config file type).
  3. Add a dedicated section to the readme that explains:
    • How to load custom extensions (both npm packages and local).
    • How to override or extend the renderer.
    • That a custom extension can be published as an npm package so everyone can benefit from it; also that it can be submitted to the list of known extensions in the Marked docs (https://marked.js.org/using_advanced#extensions).

A lot of examples and info can probably be found in past issues where I suggested overriding the renderer via a function in a .js config file.