0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-16 21:46:22 -05:00

Fix starter template's Tour component (#290)

* Fix starter template's Tour component

This component had an extra backtick and also didn't import the Markdown component.

* Add a changeset
This commit is contained in:
Matthew Phillips 2021-06-02 13:50:16 -04:00 committed by GitHub
parent 436a016408
commit 6de740d62f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 3 deletions

View file

@ -0,0 +1,5 @@
---
'astro-parser': patch
---
Fix for when there's a parser error with unmatched backticks

View file

@ -105,7 +105,7 @@ export class Parser {
} }
error({ code, message }: { code: string; message: string }, index = this.index) { error({ code, message }: { code: string; message: string }, index = this.index) {
error(message, { error(this.template, message, {
name: 'ParseError', name: 'ParseError',
code, code,
source: this.template, source: this.template,

View file

@ -27,6 +27,7 @@ export class CompileError extends Error {
/** Throw CompileError */ /** Throw CompileError */
export default function error( export default function error(
code: string,
message: string, message: string,
props: { props: {
name: string; name: string;
@ -36,7 +37,7 @@ export default function error(
end?: number; end?: number;
} }
): never { ): never {
const err = new CompileError({ message, start: props.start, end: props.end, filename: props.filename }); const err = new CompileError({ code, message, start: props.start, end: props.end, filename: props.filename });
err.name = props.name; err.name = props.name;
throw err; throw err;

View file

@ -1,3 +1,6 @@
---
import { Markdown } from 'astro/components';
---
<article> <article>
<div class="banner"> <div class="banner">
<p><strong>🧑‍🚀 Seasoned astronaut?</strong> Delete this file. Have fun!</p> <p><strong>🧑‍🚀 Seasoned astronaut?</strong> Delete this file. Have fun!</p>
@ -20,7 +23,7 @@
│ └── pages/ │ └── pages/
│ └── index.astro │ └── index.astro
└── package.json └── package.json
```` ```
Astro looks for `.astro` or `.md` files in the `src/pages/` directory. Astro looks for `.astro` or `.md` files in the `src/pages/` directory.
Each page is exposed as a route based on its file name. Each page is exposed as a route based on its file name.