zero-md icon indicating copy to clipboard operation
zero-md copied to clipboard

add 2 topics to documentation

Open AlvaroMartinez opened this issue 3 years ago • 1 comments

please mention in the documentation the event zero-md-marked-ready and the tip of using new marked.Renderer() while passing options to add features to the marked library. The way it is now in docs, it is very difficult to understand how should one add a custom extension to the Marked library. Also, it would be very useful exposing the method marked.use() in zeromd, but I guess that is more difficult.

Finally, thanks for this great piece of software, i like it far more than other markdown renderers.

Edit: As an example, I needed to rewrite every link between local markdown files. So i had to modify the link function in marked.renderer just after the marked lib was loaded. In the following code, zmd was the zeromd element.

zmd.addEventListener('zeromd-marked-ready',  function () {
    myrenderer = new marked.Renderer();
    myrenderer.link = myLinkFun;
    marked.setOptions({renderer: myrenderer});
});

AlvaroMartinez avatar Jun 21 '22 05:06 AlvaroMartinez

Hey, apologies for the late response. First of all, the zero-md-marked-ready event is from v1 - this event is deprecated in v2. The list of events can be found in the docs here: https://zerodevx.github.io/zero-md/attributes-and-helpers/

One can certainly extend functionalities of the marked library; the zero-md-ready event can be used to guarantee tha marked is loaded. Do note that the marked version used in zero-md is v2.

zerodevx avatar Jul 22 '22 16:07 zerodevx

V3 is released and there are changes to events, so do check out the docs.

Closing for now, feel free to repoen.

zerodevx avatar May 10 '24 08:05 zerodevx