Skip to content

marked v13's token renderer #73

Description

@emmercm

Unfortunately marked changed the function signatures on the renderer object.

I have some code to alter renderer behavior:

import {marked} from 'marked';
const markdownRenderer = new marked.Renderer();
markdownRenderer.heading = (text, level, raw) => {
    // ... 
};
markdownRenderer.table = (header, body) => {
    // ...
};
markdownRenderer.code = (_code, infostring, escaped) => {
    // ...
};

and then I provide that renderer like this:

import markdown from '@metalsmith/markdown';
Metalsmith(path.resolve())
    // ...
    .use(markdown({
        renderer: markdownRenderer
    }))
    // ...

markedjs/marked#3291 made it so renderers created with marked v13+ code are incompatible with <v13 versions of marked, and this plugin's version is quite old.


Maybe a warning about compatible versions of marked would suffice? I suspect this plugin's version of marked is being held back intentionally based on #70.

An eventual major upgrade of this plugin might be nice, and I'm sure you had other items for its roadmap.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions