Compare commits

...

10 commits

Author SHA1 Message Date
Fred K. Schott
0af53a7e8d Version Packages (manual) 2021-08-13 09:54:23 -07:00
Fred K. Schott
eb02a27231 minor typography changes (#1083) 2021-08-13 09:52:01 -07:00
Sia
3d9bb2f910 Remove sentence about dev server docs (#1095) 2021-08-13 09:51:52 -07:00
Naeem N
c7397bc25f Nuxt.js official page url corrected (#1096) 2021-08-13 09:51:24 -07:00
Jonathan Neal
8ae9035c65 Fix left curly bracket formatting (#1094)
* Fix curly braces

* Add tests

* chore: formatting

* sstyle: update fix to be more explicit and ireduce chance of false positive

* style: use suggestions

Co-authored-by: mmarkelov <maks-markel@mail.ru>
2021-08-13 09:51:04 -07:00
Fred K. Schott
0fb4dfc069 Version Packages (manual) 2021-08-11 16:20:20 -07:00
Fred K. Schott
6b4086d434 add changeset 2021-08-11 16:19:57 -07:00
Fred K. Schott
68c0ab3cb5 Version Packages (manual) 2021-08-11 16:05:55 -07:00
Fred K. Schott
2216366736 add changeset 2021-08-11 16:05:12 -07:00
Fred K. Schott
aad336680c Revert "Add PORT env var to be used (#952)"
This reverts commit 939b9d01a4.
2021-08-11 16:04:00 -07:00
30 changed files with 93 additions and 84 deletions

View file

@ -36,7 +36,7 @@ nav ul {
}
.content > section > * + * {
margin-top: 1rem;
margin-top: 1.25rem;
}
.content > section > :first-child {
@ -44,13 +44,13 @@ nav ul {
}
/* Typography */
:is(h1, h2, h3, h4, h5, h6) {
h1, h2, h3, h4, h5, h6 {
margin-bottom: 1rem;
font-weight: bold;
line-height: 1;
}
:is(h1, h2) {
h1, h2 {
max-width: 40ch;
}
@ -58,39 +58,37 @@ nav ul {
margin-top: 3rem;
}
:is(h4, h5, h6):not(:first-child) {
margin-top: 2rem;
}
h1 {
font-size: 2.25rem;
font-size: 3.25rem;
font-weight: 800;
}
h2 {
font-size: 1.5rem;
font-size: 2.5rem;
}
h3 {
font-size: 1.125rem;
font-size: 1.75rem;
}
h4 {
font-size: 1rem;
font-size: 1.3rem;
}
h5 {
font-size: 0.8rem;
font-size: 1rem;
}
@media (min-width: 50em) {
h1 {
font-size: 3.25rem;
font-weight: 800;
}
p {
line-height: 1.65em;
}
h2 {
font-size: 2rem;
}
h3 {
font-size: 1.25rem;
}
.content ul {
line-height: 1.1em;
}
p,

View file

@ -142,7 +142,7 @@ One big reason behind this performance difference is Astro's smaller JavaScript
## 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.

View file

@ -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)).
See the [dev server](/reference/dev) docs for more information on how the dev server works.
**Flags**
#### `--port`

View file

@ -7,7 +7,7 @@
"build": "astro build"
},
"devDependencies": {
"astro": "^0.18.10"
"astro": "^0.18.13"
},
"snowpack": {
"workspaceRoot": "../.."

View file

@ -7,7 +7,7 @@
"build": "astro build"
},
"devDependencies": {
"astro": "^0.18.10"
"astro": "^0.18.13"
},
"snowpack": {
"workspaceRoot": "../.."

View file

@ -7,7 +7,7 @@
"build": "astro build"
},
"devDependencies": {
"astro": "^0.18.10"
"astro": "^0.18.13"
},
"snowpack": {
"workspaceRoot": "../.."

View file

@ -8,7 +8,7 @@
},
"devDependencies": {
"@astrojs/renderer-lit": "^0.1.0",
"astro": "^0.18.10"
"astro": "^0.18.13"
},
"snowpack": {
"workspaceRoot": "../.."

View file

@ -7,7 +7,7 @@
"build": "astro build"
},
"devDependencies": {
"astro": "^0.18.10"
"astro": "^0.18.13"
},
"snowpack": {
"workspaceRoot": "../.."

View file

@ -7,7 +7,7 @@
"build": "astro build"
},
"devDependencies": {
"astro": "^0.18.10"
"astro": "^0.18.13"
},
"snowpack": {
"workspaceRoot": "../.."

View file

@ -7,7 +7,7 @@
"build": "astro build"
},
"devDependencies": {
"astro": "^0.18.10"
"astro": "^0.18.13"
},
"snowpack": {
"workspaceRoot": "../.."

View file

@ -7,7 +7,7 @@
"build": "astro build"
},
"devDependencies": {
"astro": "^0.18.10",
"astro": "^0.18.13",
"@astrojs/renderer-solid": "0.1.0"
},
"snowpack": {

View file

@ -7,7 +7,7 @@
"build": "astro build"
},
"devDependencies": {
"astro": "^0.18.10"
"astro": "^0.18.13"
},
"snowpack": {
"workspaceRoot": "../.."

View file

@ -7,7 +7,7 @@
"build": "astro build"
},
"devDependencies": {
"astro": "^0.18.10"
"astro": "^0.18.13"
},
"snowpack": {
"workspaceRoot": "../.."

View file

@ -7,7 +7,7 @@
"build": "astro build"
},
"devDependencies": {
"astro": "^0.18.10"
"astro": "^0.18.13"
},
"snowpack": {
"workspaceRoot": "../.."

View file

@ -18,7 +18,7 @@
"devDependencies": {
"@contentful/rich-text-html-renderer": "^14.1.2",
"@contentful/rich-text-types": "^14.1.2",
"astro": "^0.18.10"
"astro": "^0.18.13"
},
"snowpack": {
"workspaceRoot": "../.."

View file

@ -7,7 +7,7 @@
"build": "astro build"
},
"devDependencies": {
"astro": "^0.18.10"
"astro": "^0.18.13"
},
"snowpack": {
"workspaceRoot": "../.."

View file

@ -7,7 +7,7 @@
"build": "astro build"
},
"devDependencies": {
"astro": "^0.18.10",
"astro": "^0.18.13",
"rehype-add-classes": "^1.0.0",
"rehype-toc": "^3.0.2",
"remark-autolink-headings": "^6.0.1",

View file

@ -7,7 +7,7 @@
"build": "astro build"
},
"devDependencies": {
"astro": "^0.18.10"
"astro": "^0.18.13"
},
"snowpack": {
"workspaceRoot": "../.."

View file

@ -7,7 +7,7 @@
"build": "astro build"
},
"devDependencies": {
"astro": "^0.18.10"
"astro": "^0.18.13"
},
"dependencies": {
"nanostores": "^0.3.3"

View file

@ -8,7 +8,7 @@
},
"devDependencies": {
"tailwindcss": "^2.1.2",
"astro": "^0.18.10"
"astro": "^0.18.13"
},
"snowpack": {
"workspaceRoot": "../.."

View file

@ -1,5 +1,23 @@
# 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
### Patch Changes

View file

@ -1,6 +1,6 @@
{
"name": "astro",
"version": "0.18.10",
"version": "0.18.13",
"author": "Skypack",
"license": "MIT",
"type": "module",

View file

@ -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 */
function resolveArgs(flags: Arguments): CLIState {
const { PORT } = process.env;
// Merge options (Flags take priority)
const options = {
...validateOptions(
{ port: PORT },
{
port: [parseInt, 'number'],
}
),
...validateOptions(flags, {
projectRoot: 'string',
site: 'string',
sitemap: 'boolean',
port: 'number',
config: 'string',
}),
const options: CLIState['options'] = {
projectRoot: typeof flags.projectRoot === 'string' ? flags.projectRoot : undefined,
site: typeof flags.site === 'string' ? flags.site : undefined,
sitemap: typeof flags.sitemap === 'boolean' ? flags.sitemap : undefined,
port: typeof flags.port === 'number' ? flags.port : undefined,
config: typeof flags.config === 'string' ? flags.config : undefined,
};
if (flags.version) {
@ -131,7 +101,7 @@ function mergeCLIFlags(astroConfig: AstroConfig, flags: CLIState['options']) {
}
/** 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 {
const projectRoot = options.projectRoot || rawRoot;
const astroConfig = await loadConfig(projectRoot, options.config);

View file

@ -769,7 +769,7 @@ async function compileHtml(enterNode: TemplateNode, state: CodegenState, compile
}
if (parent.name === 'code') {
// Special case, escaped { characters from markdown content
text = node.raw.replace(/&#x26;#123;/g, '{');
text = node.raw.replace(/ASTRO_ESCAPED_LEFT_CURLY_BRACKET\0/g, '{');
}
buffers[curr] += ',' + JSON.stringify(text);
return;

View file

@ -11,14 +11,14 @@ function escape(code: string) {
.replace(/[`$]/g, (match) => {
return '\\' + match;
})
.replace(/&#123;/g, '{');
.replace(/ASTRO_ESCAPED_LEFT_CURLY_BRACKET\0/g, '{');
}
/** Unescape { characters transformed by Markdown generation */
function unescapeCode(code: TemplateNode) {
code.children = code.children?.map((child) => {
if (child.type === 'Text') {
return { ...child, raw: child.raw.replace(/&#x26;#123;/g, '{') };
return { ...child, raw: child.raw.replace(/ASTRO_ESCAPED_LEFT_CURLY_BRACKET\0/g, '{') };
}
return child;
});

View file

@ -90,6 +90,17 @@ Markdown('Renders dynamic content though the content attribute', async ({ runtim
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 }) => {
const result = await runtime.load('/close');
assert.ok(!result.error, `build error: ${result.error}`);

View 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>

View file

@ -21,7 +21,7 @@ export function rehypeCodeBlock() {
const escapeCode = (code: any) => {
code.children = code.children.map((child: any) => {
if (child.type === 'text') {
return { ...child, value: child.value.replace(/\{/g, '&#123;') };
return { ...child, value: child.value.replace(/\{/g, 'ASTRO_ESCAPED_LEFT_CURLY_BRACKET\0') };
}
return child;
});

View file

@ -29,7 +29,7 @@
"vscode-languageserver-textdocument": "^1.0.1"
},
"devDependencies": {
"astro": "0.18.10",
"astro": "0.18.13",
"astro-scripts": "0.0.1"
}
}

View file

@ -7,6 +7,6 @@
"build": "astro build"
},
"devDependencies": {
"astro": "^0.18.10"
"astro": "^0.18.13"
}
}