[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);
|
||||
}
|
||||
|
||||
const $$content = ${JSON.stringify(isMDX
|
||||
? content
|
||||
// Avoid stripping "setup" and "components"
|
||||
// in plain MD mode
|
||||
: { ...content, setup, components })}
|
||||
const $$content = ${JSON.stringify(
|
||||
isMDX
|
||||
? content
|
||||
: // Avoid stripping "setup" and "components"
|
||||
// in plain MD mode
|
||||
{ ...content, setup, components }
|
||||
)}
|
||||
---`;
|
||||
const imports = `${layout ? `import Layout from '${layout}';` : ''}
|
||||
${isMDX ? setup : ''}`.trim();
|
||||
|
@ -189,7 +191,7 @@ ${isMDX ? setup : ''}`.trim();
|
|||
// Wrap with set:html fragment to skip
|
||||
// JSX expressions and components in "plain" md mode
|
||||
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
|
||||
|
|
|
@ -46,7 +46,7 @@ export async function renderMarkdown(
|
|||
|
||||
let parser = unified()
|
||||
.use(markdown)
|
||||
.use(isMDX ? [remarkMdxish, remarkMarkAndUnravel, remarkUnwrap, remarkEscape] : [])
|
||||
.use(isMDX ? [remarkMdxish, remarkMarkAndUnravel, remarkUnwrap, remarkEscape] : []);
|
||||
|
||||
if (remarkPlugins.length === 0 && rehypePlugins.length === 0) {
|
||||
remarkPlugins = [...DEFAULT_REMARK_PLUGINS];
|
||||
|
@ -75,13 +75,15 @@ export async function renderMarkdown(
|
|||
markdownToHtml as any,
|
||||
{
|
||||
allowDangerousHtml: true,
|
||||
passThrough: isMDX ? [
|
||||
'raw',
|
||||
'mdxFlowExpression',
|
||||
'mdxJsxFlowElement',
|
||||
'mdxJsxTextElement',
|
||||
'mdxTextExpression',
|
||||
] : [],
|
||||
passThrough: isMDX
|
||||
? [
|
||||
'raw',
|
||||
'mdxFlowExpression',
|
||||
'mdxJsxFlowElement',
|
||||
'mdxJsxTextElement',
|
||||
'mdxTextExpression',
|
||||
]
|
||||
: [],
|
||||
},
|
||||
],
|
||||
]);
|
||||
|
@ -91,13 +93,11 @@ export async function renderMarkdown(
|
|||
});
|
||||
|
||||
parser
|
||||
.use(isMDX ? [
|
||||
rehypeJsx,
|
||||
rehypeExpressions,
|
||||
rehypeEscape,
|
||||
rehypeIslands,
|
||||
rehypeCollectHeaders,
|
||||
] : [rehypeCollectHeaders, rehypeRaw])
|
||||
.use(
|
||||
isMDX
|
||||
? [rehypeJsx, rehypeExpressions, rehypeEscape, rehypeIslands, rehypeCollectHeaders]
|
||||
: [rehypeCollectHeaders, rehypeRaw]
|
||||
)
|
||||
.use(rehypeStringify, { allowDangerousHtml: true });
|
||||
|
||||
let result: string;
|
||||
|
|
Loading…
Reference in a new issue