Fix markdown syntax issues (#234)

This fixes #233 among other things
This commit is contained in:
Matthew Phillips 2021-05-24 16:00:34 -04:00 committed by GitHub
parent c43ee95850
commit 2ff2533c9e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 19 additions and 10 deletions

View file

@ -80,7 +80,7 @@ export let content: any;
</div> </div>
</article> </article>
<Subnav title={content.title} headers={content.headers} /> <Subnav title={content.title} headers={content.astro.headers} />
</section> </section>
</div> </div>
</BaseLayout> </BaseLayout>

View file

@ -98,7 +98,7 @@ export let content: any;
</aside> </aside>
<div class="pt4"> <div class="pt4">
<Subnav title={content.title} headers={content.headers} /> <Subnav title={content.title} headers={content.astro.headers} />
</div> </div>
<article class="layout-main"> <article class="layout-main">

View file

@ -112,7 +112,7 @@ export async function compileComponent(
const site = compileOptions.astroConfig.buildOptions.site || `http://localhost:${compileOptions.astroConfig.devOptions.port}`; const site = compileOptions.astroConfig.buildOptions.site || `http://localhost:${compileOptions.astroConfig.devOptions.port}`;
// return template // return template
let modJsx = ` let moduleJavaScript = `
import fetch from 'node-fetch'; import fetch from 'node-fetch';
// <script astro></script> // <script astro></script>
@ -160,7 +160,7 @@ export async function __renderPage({request, children, props}) {
return { return {
result, result,
contents: modJsx, contents: moduleJavaScript,
css: result.css, css: result.css,
}; };
} }

View file

@ -3,7 +3,9 @@ import { visit } from 'unist-util-visit';
/** */ /** */
export function remarkCodeBlock() { export function remarkCodeBlock() {
const visitor = (node: any) => { 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 ?? ''; let currentClassName = data?.hProperties?.class ?? '';
node.data = node.data || {}; node.data = node.data || {};
node.data.hProperties = node.data.hProperties || {}; node.data.hProperties = node.data.hProperties || {};

View file

@ -18,9 +18,8 @@ function* _h(tag: string, attrs: HProps, children: Array<HChild>) {
yield `<${tag}`; yield `<${tag}`;
if (attrs) { if (attrs) {
yield ' ';
for (let [key, value] of Object.entries(attrs)) { for (let [key, value] of Object.entries(attrs)) {
yield `${key}="${value}"`; yield ` ${key}="${value}"`;
} }
} }
yield '>'; yield '>';

View file

@ -8,4 +8,10 @@ description: This is a post about some stuff.
Hello world! Hello world!
```json
{
"key": "value"
}
```
<div id="first">Some content</div> <div id="first">Some content</div>

View file

@ -10,14 +10,16 @@ const { readdir, stat } = fsPromises;
const SnowpackDev = suite('snowpack.dev'); const SnowpackDev = suite('snowpack.dev');
const snowpackDir = new URL('../../../examples/snowpack/', import.meta.url);
let runtime, cwd, setupError; let runtime, cwd, setupError;
SnowpackDev.before(async () => { SnowpackDev.before(async () => {
// Bug: Snowpack config is still loaded relative to the current working directory. // Bug: Snowpack config is still loaded relative to the current working directory.
cwd = process.cwd(); 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 = { const logging = {
level: 'error', level: 'error',
@ -67,7 +69,7 @@ SnowpackDev('No error creating the runtime', () => {
SnowpackDev('Can load every page', async () => { SnowpackDev('Can load every page', async () => {
const failed = []; 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)) { for await (let pathname of allPages(pageRoot)) {
if (pathname.includes('proof-of-concept-dynamic')) { if (pathname.includes('proof-of-concept-dynamic')) {
continue; continue;