diff --git a/examples/snowpack/src/layouts/content-with-cover.astro b/examples/snowpack/src/layouts/content-with-cover.astro index 0e91b406b..91cf9df39 100644 --- a/examples/snowpack/src/layouts/content-with-cover.astro +++ b/examples/snowpack/src/layouts/content-with-cover.astro @@ -80,7 +80,7 @@ export let content: any; - + diff --git a/examples/snowpack/src/layouts/content.astro b/examples/snowpack/src/layouts/content.astro index 56832d551..8ab619ba5 100644 --- a/examples/snowpack/src/layouts/content.astro +++ b/examples/snowpack/src/layouts/content.astro @@ -98,7 +98,7 @@ export let content: any;
- +
diff --git a/packages/astro/src/compiler/index.ts b/packages/astro/src/compiler/index.ts index fb1ca71af..a03e9c2ae 100644 --- a/packages/astro/src/compiler/index.ts +++ b/packages/astro/src/compiler/index.ts @@ -112,7 +112,7 @@ export async function compileComponent( const site = compileOptions.astroConfig.buildOptions.site || `http://localhost:${compileOptions.astroConfig.devOptions.port}`; // return template - let modJsx = ` + let moduleJavaScript = ` import fetch from 'node-fetch'; // @@ -160,7 +160,7 @@ export async function __renderPage({request, children, props}) { return { result, - contents: modJsx, + contents: moduleJavaScript, css: result.css, }; } diff --git a/packages/astro/src/compiler/markdown/codeblock.ts b/packages/astro/src/compiler/markdown/codeblock.ts index d784d335c..2f48c6631 100644 --- a/packages/astro/src/compiler/markdown/codeblock.ts +++ b/packages/astro/src/compiler/markdown/codeblock.ts @@ -3,7 +3,9 @@ import { visit } from 'unist-util-visit'; /** */ export function remarkCodeBlock() { const visitor = (node: any) => { - const { data, lang, meta } = node; + const { data, meta } = node; + let lang = node.lang || 'html'; // default to html matches GFM behavior. + let currentClassName = data?.hProperties?.class ?? ''; node.data = node.data || {}; node.data.hProperties = node.data.hProperties || {}; diff --git a/packages/astro/src/frontend/h.ts b/packages/astro/src/frontend/h.ts index c1e21dc95..ae54072a8 100644 --- a/packages/astro/src/frontend/h.ts +++ b/packages/astro/src/frontend/h.ts @@ -18,9 +18,8 @@ function* _h(tag: string, attrs: HProps, children: Array) { yield `<${tag}`; if (attrs) { - yield ' '; for (let [key, value] of Object.entries(attrs)) { - yield `${key}="${value}"`; + yield ` ${key}="${value}"`; } } yield '>'; diff --git a/packages/astro/test/fixtures/plain-markdown/src/pages/post.md b/packages/astro/test/fixtures/plain-markdown/src/pages/post.md index 5b2f32348..8dbf3e47e 100644 --- a/packages/astro/test/fixtures/plain-markdown/src/pages/post.md +++ b/packages/astro/test/fixtures/plain-markdown/src/pages/post.md @@ -8,4 +8,10 @@ description: This is a post about some stuff. Hello world! +```json +{ + "key": "value" +} +``` +
Some content
diff --git a/packages/astro/test/snowpack-integration.test.js b/packages/astro/test/snowpack-integration.test.js index cdccff14a..abb06517f 100644 --- a/packages/astro/test/snowpack-integration.test.js +++ b/packages/astro/test/snowpack-integration.test.js @@ -10,14 +10,16 @@ const { readdir, stat } = fsPromises; const SnowpackDev = suite('snowpack.dev'); +const snowpackDir = new URL('../../../examples/snowpack/', import.meta.url); + let runtime, cwd, setupError; SnowpackDev.before(async () => { // Bug: Snowpack config is still loaded relative to the current working directory. cwd = process.cwd(); - process.chdir(fileURLToPath(new URL('../examples/snowpack/', import.meta.url))); + process.chdir(fileURLToPath(snowpackDir)); - const astroConfig = await loadConfig(fileURLToPath(new URL('../examples/snowpack', import.meta.url))); + const astroConfig = await loadConfig(fileURLToPath(snowpackDir)); const logging = { level: 'error', @@ -67,7 +69,7 @@ SnowpackDev('No error creating the runtime', () => { SnowpackDev('Can load every page', async () => { const failed = []; - const pageRoot = new URL('../examples/snowpack/src/pages/', import.meta.url); + const pageRoot = new URL('./src/pages/', snowpackDir); for await (let pathname of allPages(pageRoot)) { if (pathname.includes('proof-of-concept-dynamic')) { continue;