Skip to content

v1.1.0

Compare
Choose a tag to compare
@idreyn idreyn released this 05 Oct 21:43
· 17 commits to master since this release

fromProsemirror/fromPandoc configuration now takes an arbitrary resources object, instead of an arbitrary resource function. This turns out to be much more ergonomic when dealing with many different kinds of transformable resources.

Old usage:

// ruleset
rules.toProsemirrorNode("Image", (node, { resource }) => {
    return {
        type: "image",
        attrs: {
            url: resource(node.target.url),
        },
    };
});

// invocation
fromPandoc(ast, rules, { resource: imageTransformFn });

New usage:

// ruleset
rules.toProsemirrorNode("Image", (node, { resources }) => {
    return {
        type: "image",
        attrs: {
            url: resources.image(node.target.url),
        },
    };
});

// invocation
fromPandoc(ast, rules, { resources: { image: imageTransformFn } });