From 670df58feefd4bbb113b1f241ae91141cdaf621f Mon Sep 17 00:00:00 2001 From: Mike Fix Date: Mon, 7 Aug 2023 15:58:29 -0700 Subject: [PATCH] rename tokenizerOptions as options --- src/loader.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/loader.js b/src/loader.js index e049289..fe57a28 100644 --- a/src/loader.js +++ b/src/loader.js @@ -52,13 +52,13 @@ async function load(source) { dir, // Root directory from Next.js (contains next.config.js) mode = 'static', schemaPath = DEFAULT_SCHEMA_PATH, - tokenizerOptions: {slots = false, ...tokenizerOptions} = { + options: {slots = false, ...options} = { allowComments: true, }, appDir = false, } = this.getOptions() || {}; - const tokenizer = new Markdoc.Tokenizer(tokenizerOptions); + const tokenizer = new Markdoc.Tokenizer(options); const schemaDir = path.resolve(dir, schemaPath || DEFAULT_SCHEMA_PATH); const tokens = tokenizer.tokenize(source); @@ -134,7 +134,7 @@ import {getSchema, defaultObject} from '${normalize( ${schemaCode} const tokenizer = new Markdoc.Tokenizer(${ - tokenizerOptions ? JSON.stringify(tokenizerOptions) : '' + options ? JSON.stringify(options) : '' }); /** @@ -195,13 +195,17 @@ async function getMarkdocData(context = {}) { ); } -${appDir ? '' : `export async function ${dataFetchingFunction}(context) { +${ + appDir + ? '' + : `export async function ${dataFetchingFunction}(context) { return { props: { markdoc: await getMarkdocData(context), }, }; -}`} +}` +} export default${appDir ? ' async' : ''} function MarkdocComponent(props) { const markdoc = ${appDir ? 'await getMarkdocData()' : 'props.markdoc'};