[ci] format
This commit is contained in:
parent
00fab4ce13
commit
41f4a8f9cb
7 changed files with 33 additions and 31 deletions
|
@ -703,7 +703,7 @@ export interface AstroUserConfig {
|
|||
* @see https://docs.astro.build/en/guides/integrations-guide/mdx/
|
||||
* Default: false
|
||||
*/
|
||||
astroFlavoredMarkdown?: boolean;
|
||||
astroFlavoredMarkdown?: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ const ASTRO_CONFIG_DEFAULTS: AstroUserConfig & any = {
|
|||
vite: {},
|
||||
legacy: {
|
||||
astroFlavoredMarkdown: false,
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
async function resolvePostcssConfig(inlineOptions: any, root: URL): Promise<PostCSSConfigResult> {
|
||||
|
@ -214,7 +214,10 @@ export const AstroConfigSchema = z.object({
|
|||
.default(ASTRO_CONFIG_DEFAULTS.vite),
|
||||
legacy: z
|
||||
.object({
|
||||
astroFlavoredMarkdown: z.boolean().optional().default(ASTRO_CONFIG_DEFAULTS.legacy.astroFlavoredMarkdown),
|
||||
astroFlavoredMarkdown: z
|
||||
.boolean()
|
||||
.optional()
|
||||
.default(ASTRO_CONFIG_DEFAULTS.legacy.astroFlavoredMarkdown),
|
||||
})
|
||||
.optional()
|
||||
.default({}),
|
||||
|
|
|
@ -175,7 +175,7 @@ export async function render(
|
|||
logging,
|
||||
markdown: {
|
||||
...astroConfig.markdown,
|
||||
isAstroFlavoredMd: astroConfig.legacy.astroFlavoredMarkdown
|
||||
isAstroFlavoredMd: astroConfig.legacy.astroFlavoredMarkdown,
|
||||
},
|
||||
mod,
|
||||
mode,
|
||||
|
|
|
@ -59,7 +59,7 @@ export async function renderJSX(result: SSRResult, vnode: any): Promise<any> {
|
|||
|
||||
if (vnode.type) {
|
||||
if (typeof vnode.type === 'function' && (vnode.type as any)['astro:renderer']) {
|
||||
skipAstroJSXCheck.add(vnode.type)
|
||||
skipAstroJSXCheck.add(vnode.type);
|
||||
}
|
||||
if (typeof vnode.type === 'function' && vnode.props['server:root']) {
|
||||
const output = await vnode.type(vnode.props ?? {});
|
||||
|
@ -91,7 +91,7 @@ export async function renderJSX(result: SSRResult, vnode: any): Promise<any> {
|
|||
}
|
||||
if (!isVNode(child)) {
|
||||
_slots.default.push(child);
|
||||
return
|
||||
return;
|
||||
}
|
||||
if ('slot' in child.props) {
|
||||
_slots[child.props.slot] = [...(_slots[child.props.slot] ?? []), child];
|
||||
|
@ -110,10 +110,12 @@ export async function renderJSX(result: SSRResult, vnode: any): Promise<any> {
|
|||
const slotPromises = [];
|
||||
const slots: Record<string, any> = {};
|
||||
for (const [key, value] of Object.entries(_slots)) {
|
||||
slotPromises.push(renderJSX(result, value).then(output => {
|
||||
if (output.toString().trim().length === 0) return;
|
||||
slots[key] = () => output;
|
||||
}))
|
||||
slotPromises.push(
|
||||
renderJSX(result, value).then((output) => {
|
||||
if (output.toString().trim().length === 0) return;
|
||||
slots[key] = () => output;
|
||||
})
|
||||
);
|
||||
}
|
||||
await Promise.all(slotPromises);
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ export const DEFAULT_REHYPE_PLUGINS = [];
|
|||
/** Shared utility for rendering markdown */
|
||||
export async function renderMarkdown(
|
||||
content: string,
|
||||
opts: MarkdownRenderingOptions,
|
||||
opts: MarkdownRenderingOptions
|
||||
): Promise<MarkdownRenderingResult> {
|
||||
let {
|
||||
fileURL,
|
||||
|
|
|
@ -35,7 +35,7 @@ describe('autolinking', () => {
|
|||
});
|
||||
|
||||
describe('astro-flavored md', () => {
|
||||
const renderAstroMd = text => renderMarkdown(text, { isAstroFlavoredMd: true });
|
||||
const renderAstroMd = (text) => renderMarkdown(text, { isAstroFlavoredMd: true });
|
||||
|
||||
it('does not autolink URLs in code blocks', async () => {
|
||||
const { code } = await renderAstroMd(
|
||||
|
@ -104,5 +104,5 @@ describe('autolinking', () => {
|
|||
`</strong></a>`
|
||||
);
|
||||
});
|
||||
})
|
||||
});
|
||||
});
|
||||
|
|
|
@ -67,10 +67,7 @@ describe('strictness in Astro-flavored markdown', () => {
|
|||
});
|
||||
|
||||
it('should allow attribute names starting with "@" after attribute names', async () => {
|
||||
const { code } = await renderAstroMd(
|
||||
`<button disabled @click="handleClick">Test</button>`,
|
||||
{}
|
||||
);
|
||||
const { code } = await renderAstroMd(`<button disabled @click="handleClick">Test</button>`, {});
|
||||
|
||||
chai.expect(code.trim()).to.equal(`<button disabled @click="handleClick">Test</button>`);
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue