Skip to content

Commit

Permalink
7576 - rename "enableHTML" option to "allowHTML"
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-sherwin committed Jul 7, 2023
1 parent a1fecae commit 10e0eec
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/integrations/markdoc/src/content-entry-type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export async function getContentEntryType({
const tokenizer = getMarkdocTokenizer(options);
let tokens = tokenizer.tokenize(entry.body);

if (options?.enableHTML) {
if (options?.allowHTML) {
tokens = htmlTokenTransform(tokenizer, tokens);
}

Expand Down
2 changes: 1 addition & 1 deletion packages/integrations/markdoc/src/options.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export interface MarkdocIntegrationOptions {
enableHTML?: boolean;
allowHTML?: boolean;
}
6 changes: 3 additions & 3 deletions packages/integrations/markdoc/src/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export async function setupConfig(userConfig: AstroMarkdocConfig = {}, options:

let merged = mergeConfig(defaultConfig, userConfig);

if (options?.enableHTML) {
if (options?.allowHTML) {
merged = mergeConfig(merged, HTML_CONFIG);
}

Expand All @@ -46,7 +46,7 @@ export function setupConfigSync(userConfig: AstroMarkdocConfig = {}, options: Ma

let merged = mergeConfig(defaultConfig, userConfig);

if (options?.enableHTML) {
if (options?.allowHTML) {
merged = mergeConfig(merged, HTML_CONFIG);
}

Expand Down Expand Up @@ -197,7 +197,7 @@ export function createContentComponent(
});
}

// statically define a partial MarkdocConfig which registers the required "html-tag" Markdoc tag when the "enableHTML" feature is enabled
// statically define a partial MarkdocConfig which registers the required "html-tag" Markdoc tag when the "allowHTML" feature is enabled
const HTML_CONFIG: AstroMarkdocConfig = {
tags: {
"html-tag": htmlTag,
Expand Down
2 changes: 1 addition & 1 deletion packages/integrations/markdoc/src/tokenizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export function getMarkdocTokenizer(options: MarkdocIntegrationOptions | undefin
allowComments: true,
}

if (options?.enableHTML) {
if (options?.allowHTML) {
// we want to allow indentation for Markdoc tags that are interleaved inside HTML block elements
tokenizerOptions.allowIndentation = true;
// enable HTML token detection in markdown-it
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ import markdoc from '@astrojs/markdoc';

// https://astro.build/config
export default defineConfig({
integrations: [markdoc({ enableHTML: true })],
integrations: [markdoc({ allowHTML: true })],
});

0 comments on commit 10e0eec

Please sign in to comment.