Skip to content

Commit

Permalink
rename tokenizerOptions as options
Browse files Browse the repository at this point in the history
  • Loading branch information
mfix-stripe committed Aug 7, 2023
1 parent b6d5192 commit 670df58
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -134,7 +134,7 @@ import {getSchema, defaultObject} from '${normalize(
${schemaCode}
const tokenizer = new Markdoc.Tokenizer(${
tokenizerOptions ? JSON.stringify(tokenizerOptions) : ''
options ? JSON.stringify(options) : ''
});
/**
Expand Down Expand Up @@ -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'};
Expand Down

0 comments on commit 670df58

Please sign in to comment.