Compare commits
10 commits
main
...
release/0.
Author | SHA1 | Date | |
---|---|---|---|
|
0af53a7e8d | ||
|
eb02a27231 | ||
|
3d9bb2f910 | ||
|
c7397bc25f | ||
|
8ae9035c65 | ||
|
0fb4dfc069 | ||
|
6b4086d434 | ||
|
68c0ab3cb5 | ||
|
2216366736 | ||
|
aad336680c |
30 changed files with 93 additions and 84 deletions
|
@ -36,7 +36,7 @@ nav ul {
|
||||||
}
|
}
|
||||||
|
|
||||||
.content > section > * + * {
|
.content > section > * + * {
|
||||||
margin-top: 1rem;
|
margin-top: 1.25rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.content > section > :first-child {
|
.content > section > :first-child {
|
||||||
|
@ -44,13 +44,13 @@ nav ul {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Typography */
|
/* Typography */
|
||||||
:is(h1, h2, h3, h4, h5, h6) {
|
h1, h2, h3, h4, h5, h6 {
|
||||||
margin-bottom: 1rem;
|
margin-bottom: 1rem;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
:is(h1, h2) {
|
h1, h2 {
|
||||||
max-width: 40ch;
|
max-width: 40ch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,39 +58,37 @@ nav ul {
|
||||||
margin-top: 3rem;
|
margin-top: 3rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:is(h4, h5, h6):not(:first-child) {
|
||||||
|
margin-top: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
h1 {
|
h1 {
|
||||||
font-size: 2.25rem;
|
font-size: 3.25rem;
|
||||||
|
font-weight: 800;
|
||||||
}
|
}
|
||||||
|
|
||||||
h2 {
|
h2 {
|
||||||
font-size: 1.5rem;
|
font-size: 2.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
h3 {
|
h3 {
|
||||||
font-size: 1.125rem;
|
font-size: 1.75rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
h4 {
|
h4 {
|
||||||
font-size: 1rem;
|
font-size: 1.3rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
h5 {
|
h5 {
|
||||||
font-size: 0.8rem;
|
font-size: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (min-width: 50em) {
|
p {
|
||||||
h1 {
|
line-height: 1.65em;
|
||||||
font-size: 3.25rem;
|
}
|
||||||
font-weight: 800;
|
|
||||||
}
|
|
||||||
|
|
||||||
h2 {
|
.content ul {
|
||||||
font-size: 2rem;
|
line-height: 1.1em;
|
||||||
}
|
|
||||||
|
|
||||||
h3 {
|
|
||||||
font-size: 1.25rem;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
p,
|
p,
|
||||||
|
|
|
@ -142,7 +142,7 @@ One big reason behind this performance difference is Astro's smaller JavaScript
|
||||||
|
|
||||||
## Nuxt vs. Astro
|
## Nuxt vs. Astro
|
||||||
|
|
||||||
[Nuxt](https://nextjs.org/) is a popular website & application framework for Vue. It is similar to Next.js.
|
[Nuxt](https://nuxtjs.org/) is a popular website & application framework for Vue. It is similar to Next.js.
|
||||||
|
|
||||||
Nuxt uses Vue to render your website. Astro is more flexible: you can use any UI component libraries (React, Preact, Vue, Svelte, and others) or Astro's built-in component syntax that is similar to HTML/JSX.
|
Nuxt uses Vue to render your website. Astro is more flexible: you can use any UI component libraries (React, Preact, Vue, Svelte, and others) or Astro's built-in component syntax that is similar to HTML/JSX.
|
||||||
|
|
||||||
|
|
|
@ -9,8 +9,6 @@ title: CLI Reference
|
||||||
|
|
||||||
Runs the Astro development server. This starts an HTTP server that responds to requests for pages stored in `src/pages` (or which folder is specified in your [configuration](/reference/configuration-reference)).
|
Runs the Astro development server. This starts an HTTP server that responds to requests for pages stored in `src/pages` (or which folder is specified in your [configuration](/reference/configuration-reference)).
|
||||||
|
|
||||||
See the [dev server](/reference/dev) docs for more information on how the dev server works.
|
|
||||||
|
|
||||||
**Flags**
|
**Flags**
|
||||||
|
|
||||||
#### `--port`
|
#### `--port`
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
"build": "astro build"
|
"build": "astro build"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"astro": "^0.18.10"
|
"astro": "^0.18.13"
|
||||||
},
|
},
|
||||||
"snowpack": {
|
"snowpack": {
|
||||||
"workspaceRoot": "../.."
|
"workspaceRoot": "../.."
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
"build": "astro build"
|
"build": "astro build"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"astro": "^0.18.10"
|
"astro": "^0.18.13"
|
||||||
},
|
},
|
||||||
"snowpack": {
|
"snowpack": {
|
||||||
"workspaceRoot": "../.."
|
"workspaceRoot": "../.."
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
"build": "astro build"
|
"build": "astro build"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"astro": "^0.18.10"
|
"astro": "^0.18.13"
|
||||||
},
|
},
|
||||||
"snowpack": {
|
"snowpack": {
|
||||||
"workspaceRoot": "../.."
|
"workspaceRoot": "../.."
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@astrojs/renderer-lit": "^0.1.0",
|
"@astrojs/renderer-lit": "^0.1.0",
|
||||||
"astro": "^0.18.10"
|
"astro": "^0.18.13"
|
||||||
},
|
},
|
||||||
"snowpack": {
|
"snowpack": {
|
||||||
"workspaceRoot": "../.."
|
"workspaceRoot": "../.."
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
"build": "astro build"
|
"build": "astro build"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"astro": "^0.18.10"
|
"astro": "^0.18.13"
|
||||||
},
|
},
|
||||||
"snowpack": {
|
"snowpack": {
|
||||||
"workspaceRoot": "../.."
|
"workspaceRoot": "../.."
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
"build": "astro build"
|
"build": "astro build"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"astro": "^0.18.10"
|
"astro": "^0.18.13"
|
||||||
},
|
},
|
||||||
"snowpack": {
|
"snowpack": {
|
||||||
"workspaceRoot": "../.."
|
"workspaceRoot": "../.."
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
"build": "astro build"
|
"build": "astro build"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"astro": "^0.18.10"
|
"astro": "^0.18.13"
|
||||||
},
|
},
|
||||||
"snowpack": {
|
"snowpack": {
|
||||||
"workspaceRoot": "../.."
|
"workspaceRoot": "../.."
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
"build": "astro build"
|
"build": "astro build"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"astro": "^0.18.10",
|
"astro": "^0.18.13",
|
||||||
"@astrojs/renderer-solid": "0.1.0"
|
"@astrojs/renderer-solid": "0.1.0"
|
||||||
},
|
},
|
||||||
"snowpack": {
|
"snowpack": {
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
"build": "astro build"
|
"build": "astro build"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"astro": "^0.18.10"
|
"astro": "^0.18.13"
|
||||||
},
|
},
|
||||||
"snowpack": {
|
"snowpack": {
|
||||||
"workspaceRoot": "../.."
|
"workspaceRoot": "../.."
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
"build": "astro build"
|
"build": "astro build"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"astro": "^0.18.10"
|
"astro": "^0.18.13"
|
||||||
},
|
},
|
||||||
"snowpack": {
|
"snowpack": {
|
||||||
"workspaceRoot": "../.."
|
"workspaceRoot": "../.."
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
"build": "astro build"
|
"build": "astro build"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"astro": "^0.18.10"
|
"astro": "^0.18.13"
|
||||||
},
|
},
|
||||||
"snowpack": {
|
"snowpack": {
|
||||||
"workspaceRoot": "../.."
|
"workspaceRoot": "../.."
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@contentful/rich-text-html-renderer": "^14.1.2",
|
"@contentful/rich-text-html-renderer": "^14.1.2",
|
||||||
"@contentful/rich-text-types": "^14.1.2",
|
"@contentful/rich-text-types": "^14.1.2",
|
||||||
"astro": "^0.18.10"
|
"astro": "^0.18.13"
|
||||||
},
|
},
|
||||||
"snowpack": {
|
"snowpack": {
|
||||||
"workspaceRoot": "../.."
|
"workspaceRoot": "../.."
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
"build": "astro build"
|
"build": "astro build"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"astro": "^0.18.10"
|
"astro": "^0.18.13"
|
||||||
},
|
},
|
||||||
"snowpack": {
|
"snowpack": {
|
||||||
"workspaceRoot": "../.."
|
"workspaceRoot": "../.."
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
"build": "astro build"
|
"build": "astro build"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"astro": "^0.18.10",
|
"astro": "^0.18.13",
|
||||||
"rehype-add-classes": "^1.0.0",
|
"rehype-add-classes": "^1.0.0",
|
||||||
"rehype-toc": "^3.0.2",
|
"rehype-toc": "^3.0.2",
|
||||||
"remark-autolink-headings": "^6.0.1",
|
"remark-autolink-headings": "^6.0.1",
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
"build": "astro build"
|
"build": "astro build"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"astro": "^0.18.10"
|
"astro": "^0.18.13"
|
||||||
},
|
},
|
||||||
"snowpack": {
|
"snowpack": {
|
||||||
"workspaceRoot": "../.."
|
"workspaceRoot": "../.."
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
"build": "astro build"
|
"build": "astro build"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"astro": "^0.18.10"
|
"astro": "^0.18.13"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"nanostores": "^0.3.3"
|
"nanostores": "^0.3.3"
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"tailwindcss": "^2.1.2",
|
"tailwindcss": "^2.1.2",
|
||||||
"astro": "^0.18.10"
|
"astro": "^0.18.13"
|
||||||
},
|
},
|
||||||
"snowpack": {
|
"snowpack": {
|
||||||
"workspaceRoot": "../.."
|
"workspaceRoot": "../.."
|
||||||
|
|
|
@ -1,5 +1,23 @@
|
||||||
# astro
|
# astro
|
||||||
|
|
||||||
|
## 0.18.13
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Fix curly bracket encoding issue in markdown
|
||||||
|
|
||||||
|
## 0.18.12
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- 6b4086d4: Fix outdated publish
|
||||||
|
|
||||||
|
## 0.18.11
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- 22163667: Revert "939b9d0: Allow dev server port to be set by PORT environment variable"
|
||||||
|
|
||||||
## 0.18.10
|
## 0.18.10
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "astro",
|
"name": "astro",
|
||||||
"version": "0.18.10",
|
"version": "0.18.13",
|
||||||
"author": "Skypack",
|
"author": "Skypack",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|
|
@ -35,44 +35,14 @@ interface CLIState {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
type TypeOf = 'string' | 'boolean' | 'number';
|
|
||||||
// Validates property types of object
|
|
||||||
const validateOptions = (opts: Record<string, any>, specs: Record<string, TypeOf | [(v: any) => unknown, TypeOf]>) =>
|
|
||||||
Object.entries(specs).reduce<Record<string, any>>((options, [k, spec]) => {
|
|
||||||
const v = opts[k];
|
|
||||||
|
|
||||||
if (typeof spec === 'string' && typeof v === spec) {
|
|
||||||
options[k] = v;
|
|
||||||
} else if (Array.isArray(spec)) {
|
|
||||||
const [coercion, test] = spec;
|
|
||||||
const result = coercion(v);
|
|
||||||
if (typeof result === test) {
|
|
||||||
options[k] = result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return options;
|
|
||||||
}, {});
|
|
||||||
|
|
||||||
/** Determine which action the user requested */
|
/** Determine which action the user requested */
|
||||||
function resolveArgs(flags: Arguments): CLIState {
|
function resolveArgs(flags: Arguments): CLIState {
|
||||||
const { PORT } = process.env;
|
const options: CLIState['options'] = {
|
||||||
|
projectRoot: typeof flags.projectRoot === 'string' ? flags.projectRoot : undefined,
|
||||||
// Merge options (Flags take priority)
|
site: typeof flags.site === 'string' ? flags.site : undefined,
|
||||||
const options = {
|
sitemap: typeof flags.sitemap === 'boolean' ? flags.sitemap : undefined,
|
||||||
...validateOptions(
|
port: typeof flags.port === 'number' ? flags.port : undefined,
|
||||||
{ port: PORT },
|
config: typeof flags.config === 'string' ? flags.config : undefined,
|
||||||
{
|
|
||||||
port: [parseInt, 'number'],
|
|
||||||
}
|
|
||||||
),
|
|
||||||
...validateOptions(flags, {
|
|
||||||
projectRoot: 'string',
|
|
||||||
site: 'string',
|
|
||||||
sitemap: 'boolean',
|
|
||||||
port: 'number',
|
|
||||||
config: 'string',
|
|
||||||
}),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (flags.version) {
|
if (flags.version) {
|
||||||
|
@ -131,7 +101,7 @@ function mergeCLIFlags(astroConfig: AstroConfig, flags: CLIState['options']) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Handle `astro run` command */
|
/** Handle `astro run` command */
|
||||||
async function runCommand(rawRoot: string, cmd: (a: AstroConfig, opts: any) => Promise<void>, options: CLIState['options']) {
|
async function runCommand(rawRoot: string, cmd: (a: AstroConfig, options: any) => Promise<void>, options: CLIState['options']) {
|
||||||
try {
|
try {
|
||||||
const projectRoot = options.projectRoot || rawRoot;
|
const projectRoot = options.projectRoot || rawRoot;
|
||||||
const astroConfig = await loadConfig(projectRoot, options.config);
|
const astroConfig = await loadConfig(projectRoot, options.config);
|
||||||
|
|
|
@ -769,7 +769,7 @@ async function compileHtml(enterNode: TemplateNode, state: CodegenState, compile
|
||||||
}
|
}
|
||||||
if (parent.name === 'code') {
|
if (parent.name === 'code') {
|
||||||
// Special case, escaped { characters from markdown content
|
// Special case, escaped { characters from markdown content
|
||||||
text = node.raw.replace(/&#123;/g, '{');
|
text = node.raw.replace(/ASTRO_ESCAPED_LEFT_CURLY_BRACKET\0/g, '{');
|
||||||
}
|
}
|
||||||
buffers[curr] += ',' + JSON.stringify(text);
|
buffers[curr] += ',' + JSON.stringify(text);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -11,14 +11,14 @@ function escape(code: string) {
|
||||||
.replace(/[`$]/g, (match) => {
|
.replace(/[`$]/g, (match) => {
|
||||||
return '\\' + match;
|
return '\\' + match;
|
||||||
})
|
})
|
||||||
.replace(/{/g, '{');
|
.replace(/ASTRO_ESCAPED_LEFT_CURLY_BRACKET\0/g, '{');
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Unescape { characters transformed by Markdown generation */
|
/** Unescape { characters transformed by Markdown generation */
|
||||||
function unescapeCode(code: TemplateNode) {
|
function unescapeCode(code: TemplateNode) {
|
||||||
code.children = code.children?.map((child) => {
|
code.children = code.children?.map((child) => {
|
||||||
if (child.type === 'Text') {
|
if (child.type === 'Text') {
|
||||||
return { ...child, raw: child.raw.replace(/&#123;/g, '{') };
|
return { ...child, raw: child.raw.replace(/ASTRO_ESCAPED_LEFT_CURLY_BRACKET\0/g, '{') };
|
||||||
}
|
}
|
||||||
return child;
|
return child;
|
||||||
});
|
});
|
||||||
|
|
|
@ -90,6 +90,17 @@ Markdown('Renders dynamic content though the content attribute', async ({ runtim
|
||||||
assert.ok($('#inner').is('[class]'), 'Scoped class passed down');
|
assert.ok($('#inner').is('[class]'), 'Scoped class passed down');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Markdown('Renders curly braces correctly', async ({ runtime }) => {
|
||||||
|
const result = await runtime.load('/braces');
|
||||||
|
assert.ok(!result.error, `build error: ${result.error}`);
|
||||||
|
|
||||||
|
const $ = doc(result.contents);
|
||||||
|
assert.equal($('code').length, 3, 'Rendered curly braces markdown content');
|
||||||
|
assert.equal($('code:first-child').text(), '({})', 'Rendered curly braces markdown content');
|
||||||
|
assert.equal($('code:nth-child(2)').text(), '{...props}', 'Rendered curly braces markdown content');
|
||||||
|
assert.equal($('code:last-child').text(), '{/* JavaScript */}', 'Rendered curly braces markdown content');
|
||||||
|
});
|
||||||
|
|
||||||
Markdown('Does not close parent early when using content attribute (#494)', async ({ runtime }) => {
|
Markdown('Does not close parent early when using content attribute (#494)', async ({ runtime }) => {
|
||||||
const result = await runtime.load('/close');
|
const result = await runtime.load('/close');
|
||||||
assert.ok(!result.error, `build error: ${result.error}`);
|
assert.ok(!result.error, `build error: ${result.error}`);
|
||||||
|
|
14
packages/astro/test/fixtures/astro-markdown/src/pages/braces.astro
vendored
Normal file
14
packages/astro/test/fixtures/astro-markdown/src/pages/braces.astro
vendored
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
---
|
||||||
|
import { Markdown } from 'astro/components';
|
||||||
|
const title = 'My Blog Post';
|
||||||
|
const description = 'This is a post about some stuff.';
|
||||||
|
---
|
||||||
|
|
||||||
|
<Markdown>
|
||||||
|
## Interesting Topic
|
||||||
|
|
||||||
|
`({})`
|
||||||
|
`{...props}`
|
||||||
|
`{/* JavaScript */}`
|
||||||
|
|
||||||
|
</Markdown>
|
|
@ -21,7 +21,7 @@ export function rehypeCodeBlock() {
|
||||||
const escapeCode = (code: any) => {
|
const escapeCode = (code: any) => {
|
||||||
code.children = code.children.map((child: any) => {
|
code.children = code.children.map((child: any) => {
|
||||||
if (child.type === 'text') {
|
if (child.type === 'text') {
|
||||||
return { ...child, value: child.value.replace(/\{/g, '{') };
|
return { ...child, value: child.value.replace(/\{/g, 'ASTRO_ESCAPED_LEFT_CURLY_BRACKET\0') };
|
||||||
}
|
}
|
||||||
return child;
|
return child;
|
||||||
});
|
});
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
"vscode-languageserver-textdocument": "^1.0.1"
|
"vscode-languageserver-textdocument": "^1.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"astro": "0.18.10",
|
"astro": "0.18.13",
|
||||||
"astro-scripts": "0.0.1"
|
"astro-scripts": "0.0.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,6 @@
|
||||||
"build": "astro build"
|
"build": "astro build"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"astro": "^0.18.10"
|
"astro": "^0.18.13"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue