UNPKG

@connectv/marked

Version:
19 lines 764 B
import { extractCompProps } from './util/extract-comp-props'; export function linkedComponents(map) { return function (options, renderer, content) { if (options && options.href && options.href.startsWith(':')) { const name = options.href.substr(1); if (name in map) { const Comp = map[name]; const props = extractCompProps(options.title || ''); return renderer.create(Comp, Object.assign({}, props), content); } else { throw new Error('Unrecognized Linked Component:: ' + name); } } else return renderer.create("a", Object.assign({}, options), content); }; } //# sourceMappingURL=link-comp.js.map