diff --git a/index.js b/index.js index 8301356..2a3778e 100644 --- a/index.js +++ b/index.js @@ -95,6 +95,19 @@ module.exports.options = { watch: { default: false, runtimeParameter: 'watch' + }, + serializers: { + default: {}, + marks: { + default: { + annotations: { + default: [], + }, + } + }, + types: { + default: {}, + }, } }; diff --git a/lib/sanity-util.js b/lib/sanity-util.js index 2094843..b0ebd8e 100644 --- a/lib/sanity-util.js +++ b/lib/sanity-util.js @@ -17,13 +17,19 @@ function convertBlockToHTML({ blocks, cache, entriesById, options, visitedIds }) return blockToHTML.h('img', { src: normalizedImage.url }); }; + const allSerializers = { + types: { + ...(options.serializers && options.serializers.types), + image: imageSerializer + }, + marks: { + ...(options.serializers && options.serializers.marks) + } + } + return blockToHTML({ blocks, - serializers: { - types: { - image: imageSerializer - } - } + serializers: allSerializers, }); }