Docs codeblock fixes (#1931)

* Update astro & markdown code blocks for consistency

* Add 'JSX in Frontmatter' note to Migration Guide

* code block improvements
This commit is contained in:
Jonathan Neal 2021-11-19 15:29:27 -05:00 committed by GitHub
parent 16d972fe46
commit ebd4a8be3a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 15 additions and 15 deletions

View file

@ -225,7 +225,7 @@ Puedes omitir el archivo `netlify.toml` e ir directamente a [Netlify](https://ne
`.firebaserc`:
```js
```json
{
"projects": {
"default": "<YOUR_FIREBASE_ID>"

View file

@ -12,9 +12,9 @@ La variable `Astro` global está disponible en todos los contextos en los archiv
`Astro.fetchContent()` is a way to load local `*.md` files into your static site setup.
```jsx
// ./src/components/my-component.astro
```astro
---
// ./src/components/my-component.astro
const data = Astro.fetchContent('../pages/post/*.md'); // returns an array of posts that live at ./src/pages/post/*.md
---

View file

@ -14,7 +14,7 @@ To add a custom alias to your project, locate your project `snowpack.config.mjs`
To add a new import alias, define a new `alias` entry:
```ts
```js
// snowpack.config.mjs
export default {
alias: {

View file

@ -273,7 +273,7 @@ Different from most available deploy options here, [Google Cloud](https://cloud.
`.firebaserc`:
```js
```json
{
"projects": {
"default": "<YOUR_FIREBASE_ID>"

View file

@ -73,7 +73,7 @@ If you prefer not to write CSS, Astro also supports all popular CSS-in-JS librar
## CSS Modules
```js
```jsx
// 1. Converts './style.module.css' classnames to unique, scoped values.
// 2. Returns an object mapping the original classnames to their final, scoped value.
import styles from './style.module.css';

View file

@ -58,9 +58,9 @@ Astro treats any `.md` files inside of the `/src/pages` directory as pages. Thes
Markdown pages have a special frontmatter property for `layout`. This defines the relative path to an `.astro` component which should wrap your Markdown content, for example a [Layout](/core-concepts/layouts) component. All other frontmatter properties defined in your `.md` page will be exposed to the component as properties of the `content` prop. The rendered Markdown content is placed into the default `<slot />` element.
```jsx
// src/pages/index.md
```markdown
---
# src/pages/index.md
layout: ../../layouts/BaseLayout.astro
title: My cool page
---
@ -68,9 +68,9 @@ title: My cool page
# Hello World!
```
```jsx
// src/layouts/BaseLayout.astro
```astro
---
// src/layouts/BaseLayout.astro
const { content } = Astro.props;
---
<html>
@ -176,7 +176,7 @@ const expressions = 'Lorem ipsum';
- Automatic indentation normalization
- Automatic escaping of expressions inside code blocks
```jsx
```js
// This content is not transformed!
const object = { someOtherValue };
```
@ -185,7 +185,7 @@ const expressions = 'Lorem ipsum';
- Recursive Markdown support (Component children are also processed as Markdown)
<MyFancyCodePreview client:visible>
```jsx
```js
const object = { someOtherValue };
```
</MyFancyCodePreview client:visible>

View file

@ -567,7 +567,7 @@ So in short: stop trying to deduplicate layouts when there's nothing to deduplic
In other words, don't do this:
```jsx
```astro
<!-- src/components/MyComponent.astro -->
<style lang="scss">
.wrapper {

View file

@ -11,9 +11,9 @@ The `Astro` global is available in all contexts in `.astro` files. It has the fo
`Astro.fetchContent()` is a way to load local `*.md` files into your static site setup.
```jsx
// ./src/components/my-component.astro
```astro
---
// ./src/components/my-component.astro
const data = Astro.fetchContent('../pages/post/*.md'); // returns an array of posts that live at ./src/pages/post/*.md
---