[ci] format
This commit is contained in:
parent
399d7e2698
commit
476766b0d9
2 changed files with 23 additions and 21 deletions
|
@ -177,11 +177,13 @@ function $$slug(value) {
|
||||||
return slugger.slug(value);
|
return slugger.slug(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
const $$content = ${JSON.stringify(isMDX
|
const $$content = ${JSON.stringify(
|
||||||
? content
|
isMDX
|
||||||
// Avoid stripping "setup" and "components"
|
? content
|
||||||
// in plain MD mode
|
: // Avoid stripping "setup" and "components"
|
||||||
: { ...content, setup, components })}
|
// in plain MD mode
|
||||||
|
{ ...content, setup, components }
|
||||||
|
)}
|
||||||
---`;
|
---`;
|
||||||
const imports = `${layout ? `import Layout from '${layout}';` : ''}
|
const imports = `${layout ? `import Layout from '${layout}';` : ''}
|
||||||
${isMDX ? setup : ''}`.trim();
|
${isMDX ? setup : ''}`.trim();
|
||||||
|
@ -189,7 +191,7 @@ ${isMDX ? setup : ''}`.trim();
|
||||||
// Wrap with set:html fragment to skip
|
// Wrap with set:html fragment to skip
|
||||||
// JSX expressions and components in "plain" md mode
|
// JSX expressions and components in "plain" md mode
|
||||||
if (!isMDX) {
|
if (!isMDX) {
|
||||||
astroResult = `<Fragment set:html={${JSON.stringify(astroResult)}} />`
|
astroResult = `<Fragment set:html={${JSON.stringify(astroResult)}} />`;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the user imported "Layout", wrap the content in a Layout
|
// If the user imported "Layout", wrap the content in a Layout
|
||||||
|
|
|
@ -46,7 +46,7 @@ export async function renderMarkdown(
|
||||||
|
|
||||||
let parser = unified()
|
let parser = unified()
|
||||||
.use(markdown)
|
.use(markdown)
|
||||||
.use(isMDX ? [remarkMdxish, remarkMarkAndUnravel, remarkUnwrap, remarkEscape] : [])
|
.use(isMDX ? [remarkMdxish, remarkMarkAndUnravel, remarkUnwrap, remarkEscape] : []);
|
||||||
|
|
||||||
if (remarkPlugins.length === 0 && rehypePlugins.length === 0) {
|
if (remarkPlugins.length === 0 && rehypePlugins.length === 0) {
|
||||||
remarkPlugins = [...DEFAULT_REMARK_PLUGINS];
|
remarkPlugins = [...DEFAULT_REMARK_PLUGINS];
|
||||||
|
@ -75,13 +75,15 @@ export async function renderMarkdown(
|
||||||
markdownToHtml as any,
|
markdownToHtml as any,
|
||||||
{
|
{
|
||||||
allowDangerousHtml: true,
|
allowDangerousHtml: true,
|
||||||
passThrough: isMDX ? [
|
passThrough: isMDX
|
||||||
'raw',
|
? [
|
||||||
'mdxFlowExpression',
|
'raw',
|
||||||
'mdxJsxFlowElement',
|
'mdxFlowExpression',
|
||||||
'mdxJsxTextElement',
|
'mdxJsxFlowElement',
|
||||||
'mdxTextExpression',
|
'mdxJsxTextElement',
|
||||||
] : [],
|
'mdxTextExpression',
|
||||||
|
]
|
||||||
|
: [],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
|
@ -91,13 +93,11 @@ export async function renderMarkdown(
|
||||||
});
|
});
|
||||||
|
|
||||||
parser
|
parser
|
||||||
.use(isMDX ? [
|
.use(
|
||||||
rehypeJsx,
|
isMDX
|
||||||
rehypeExpressions,
|
? [rehypeJsx, rehypeExpressions, rehypeEscape, rehypeIslands, rehypeCollectHeaders]
|
||||||
rehypeEscape,
|
: [rehypeCollectHeaders, rehypeRaw]
|
||||||
rehypeIslands,
|
)
|
||||||
rehypeCollectHeaders,
|
|
||||||
] : [rehypeCollectHeaders, rehypeRaw])
|
|
||||||
.use(rehypeStringify, { allowDangerousHtml: true });
|
.use(rehypeStringify, { allowDangerousHtml: true });
|
||||||
|
|
||||||
let result: string;
|
let result: string;
|
||||||
|
|
Loading…
Reference in a new issue