docs: added code blocks without headers (#2560)

This commit is contained in:
Shahed Nasser
2022-11-07 17:36:51 +02:00
committed by GitHub
parent bbf4039147
commit c0639ef708
35 changed files with 336 additions and 98 deletions

View File

@@ -61,7 +61,7 @@ const plugins = [
newsletter_list_id: process.env.MAILCHIMP_NEWSLETTER_LIST_ID
}
}
};
];
```
## Test it Out
@@ -72,7 +72,7 @@ This plugin adds a new `POST` endpoint at `/mailchimp/subscribe`. This endpoint
Try sending a `POST` request to `/mailchimp/subscribe` with the following JSON body:
```json
```json noHeader
{
"email": "example@gmail.com"
}
@@ -90,7 +90,7 @@ If you check your Mailchimp dashboard, you should find the email added to your A
Heres an example of sending additional data with the subscription:
```json
```json noHeader
{
"email": "example@gmail.com",
"data": {

View File

@@ -79,7 +79,7 @@ You dont have to create a template for every type in the reference. You can s
<details>
<summary>Example Data</summary>
```jsx
```json noHeader
{
"beforeInsert": [Function],
"billing_address": null,
@@ -306,7 +306,7 @@ You dont have to create a template for every type in the reference. You can s
<details>
<summary>Example Data</summary>
```jsx
```json noHeader
{
"beforeInsert": [Function],
"billing_address": null,
@@ -537,7 +537,7 @@ You dont have to create a template for every type in the reference. You can s
<details>
<summary>Example Data</summary>
```jsx
```json noHeader
{
"date": Any<String>,
"email": "test@testson.com",
@@ -819,7 +819,7 @@ You dont have to create a template for every type in the reference. You can s
<details>
<summary>Example Data</summary>
```jsx
```json noHeader
{
"date": Any<String>,
"email": "test@testson.com",
@@ -1261,7 +1261,7 @@ You dont have to create a template for every type in the reference. You can s
<details>
<summary>Example Data</summary>
```jsx
```json noHeader
{
"date": Any<String>,
"email": "test@testson.com",
@@ -1703,7 +1703,7 @@ You dont have to create a template for every type in the reference. You can s
<details>
<summary>Example Data</summary>
```jsx
```json noHeader
{
"claim": Object {
"canceled_at": null,
@@ -2000,7 +2000,7 @@ You dont have to create a template for every type in the reference. You can s
<details>
<summary>Example Data</summary>
```jsx
```json noHeader
{
"locale": null,
"swap": Object {
@@ -2509,7 +2509,7 @@ You dont have to create a template for every type in the reference. You can s
<details>
<summary>Example Data</summary>
```jsx
```json noHeader
Object {
"additional_total": "16.88 USD",
"date": Any<String>,
@@ -3089,7 +3089,7 @@ You dont have to create a template for every type in the reference. You can s
<details>
<summary>Example Data</summary>
```jsx
```json noHeader
{
"locale": null,
"swap": Object {
@@ -3599,7 +3599,7 @@ You dont have to create a template for every type in the reference. You can s
<details>
<summary>Example Data</summary>
```jsx
```json noHeader
Object {
"code": Any<String>,
"value": 4,
@@ -3766,7 +3766,7 @@ You dont have to create a template for every type in the reference. You can s
<details>
<summary>Example Data</summary>
```jsx
```json noHeader
Object {
"id": Any<String>,
"email": "test@testson.com",
@@ -3786,7 +3786,7 @@ You dont have to create a template for every type in the reference. You can s
<details>
<summary>Example Data</summary>
```jsx
```json noHeader
Object {
"email": "test@testson.com",
"token": Any<String>,
@@ -3803,7 +3803,7 @@ You dont have to create a template for every type in the reference. You can s
<details>
<summary>Example Data</summary>
```jsx
```json noHeader
Object {
"product": Object {
"collection_id": null,

View File

@@ -43,7 +43,7 @@ Before running your Medusa admin, make sure that your Medusa server is running.
To run your Medusa server, go to the directory holding the server and run:
```bash npm2yarn
```bash npm2yarn noHeader
npm run start
```
@@ -65,7 +65,7 @@ Use your Medusa admins user credentials to log in.
If you installed the demo data when you installed the Medusa server by using the `--seed` option or running:
```bash npm2yarn
```bash npm2yarn noHeader
npm run seed
```

View File

@@ -235,7 +235,7 @@ If the batch job has been pre-processed, the status of the batch job will be `pr
Heres an example of the `result` property:
```json
```json noHeader
"result": {
"count": 5, // Total number of prices to be added
"stat_descriptors": [ //details about the prices to be added

View File

@@ -223,14 +223,14 @@ If the batch job has been pre-processed, the status of the batch job will be `pr
Heres an example of the `result` property:
```jsx
```json noHeader
"result": {
"count": 5, // Total number of products to be created or updated
"stat_descriptors": [ //details about the products to be created/updated
{
"key": "product-import-count",
"name": "Products/variants to import",
"message": "There will be 2 products created (0 updated).\n 3 variants will be created and 0 updated"
"message": "There will be 2 products created (0 updated).\n 3 variants will be created and 0 updated"
}
],
"advancement_count": 0 //number of products processed so far. Will be 0 before the import is confirmed.

View File

@@ -349,7 +349,7 @@ curl --location --request GET '<YOUR_SERVER>/admin/batch-jobs/<BATCH_JOB_ID>' \
Based on the batch job strategy implemented in this documentation, the `result` property could be something like this:
```jsx
```json noHeader
"result": {
"count": 1,
"stat_descriptors": [

View File

@@ -111,7 +111,7 @@ Once it is time to run your cron job based on the cron job expression pattern, t
For example, the above cron job will run at 12 AM and, when it runs, you can see the following logged on your Medusa server:
```bash
```bash noHeader
info: Processing cron job: publish-products
```

View File

@@ -24,7 +24,7 @@ A customer group is stored in the database as a [CustomerGroup](../../../refere
Similar to all entities in Medusa, you can use the `metadata` object attribute to store any custom data you want. For example, you can add some flag or tag to the customer group for a custom use case:
```jsx
```jsx noHeader
metadata: {
is_seller: true
}

View File

@@ -75,7 +75,7 @@ Be careful with your file names as it can cause unclear errors in Typeorm. Make
Before trying this step make sure that youve created and run your migrations. You also need to re-build your code using:
```bash npm2yarn
```bash npm2yarn noHeader
npm run build
```

View File

@@ -161,7 +161,7 @@ If files and directories aren't placed in the root of your plugin, the Medusa se
An example of a plugin's directory before testing or publishing:
```
```bash noHeader
medusa-plugin-custom
|
|_ _ _ api

View File

@@ -37,7 +37,7 @@ When you create a price list, you can specify different conditions to control wh
In the body of your request, aside from the required fields, you can send the following fields to apply different conditions:
```js
```js noHeader
{
prices: [
{

View File

@@ -72,7 +72,7 @@ This method accepts the variant ID as a first parameter and the [context](./inde
This method must return an object having the following fields:
```typescript
```typescript noHeader
{
originalPrice, //number | null
calculatedPrice, //number | null

View File

@@ -54,7 +54,7 @@ In this section, you'll learn how to use services throughout your Medusa server.
Before using your service, make sure you run the `build` command:
```bash npm2yarn
```bash npm2yarn noHeader
npm run build
```

View File

@@ -58,7 +58,7 @@ The `ShippingMethod` entity also has the `includes_tax` attribute. Its value is
When a price is tax-inclusive, the tax amount is calculated using the following formula:
```jsx
```jsx noHeader
const taxAmount = (taxRate * taxInclusivePrice) / (1 + taxRate)
```
@@ -110,7 +110,7 @@ Price lists include a list of prices that can be used to override the original p
Each variants price in the price list is compared to the variants original price using the following condition:
```jsx
```jsx noHeader
amount < (1 + taxRate) * calculatedPrice
```
@@ -120,7 +120,7 @@ Where `amount` is the amount of the variants price in the price list, `taxRat
Here is an example of these fields when tax inclusivity is enabled for both the currency and the price list:
```jsx
```jsx noHeader
{
original_price: 110,
calculated_price: 100,

View File

@@ -93,6 +93,33 @@ If the admonition does not match any of the mentioned criteria, always default t
If you are adding images to a documentation page, you can host the image on [Imgur](https://imgur.com) for free.
## Code Block Types
In the Medusa documentation, there are two code block types: code blocks with headers and code blocks without headers.
Code blocks without headers should be used when:
- The code block is used inside an Admonition.
- The content of the code block can't be reported (for example, if the code block contains only a text of the expected output).
In all other cases, code blocks with headers should be used.
### Code Blocks with Headers
By default, all code blocks have headers and no additional actions are required to add the header.
### Code Blocks without Headers
To add a code block without a header, simply add `noHeader` after the beginning backticks of the code block. For example:
~~~md
```bash noHeader
this code block does not have a header
```
~~~
`noHeader` should be added after the language of the code block (which is `bash` in the above example). If you used `npm2yarn` as well, `noHeader` should be after it.
## NPM and Yarn Code Blocks
If youre adding code blocks that use NPM and Yarn, you must use the [npm2yarn syntax](https://docusaurus.io/docs/markdown-features/code-blocks#npm2yarn-remark-plugin).

View File

@@ -180,7 +180,7 @@ Youll have to follow five steps for the initialization:
Youll be asked to either connect to an existing Netlify website or create a new one. Choose the second option to create a new site:
```bash
```bash noHeader
? What would you like to do?
⇄ Connect this directory to an existing Netlify site
+ Create & configure a new site
@@ -198,7 +198,7 @@ Youll be asked to optionally enter a site name.
At this point, the website is created on Netlify. However, Netlify needs to configure Webhooks and deployment keys. Youll be asked to either authorize GitHub through Netlifys website or through a personal access token. Youre free to choose either:
```bash
```bash noHeader
? Netlify CLI needs access to your GitHub account to configure Webhooks and Depl
oy Keys. What would you like to do? (Use arrow keys)
Authorize with GitHub through app.netlify.com

View File

@@ -138,7 +138,7 @@ If you havent added any products to your Medusa server, the build process mig
Alternatively, you can seed the server with demo data by running this command in the root directory of the server:
```bash
```bash noHeader
medusa seed -f data/seed.json
```
@@ -198,7 +198,7 @@ Youll have to follow five steps for the initialization:
Youll be asked to either connect to an existing Netlify website or create a new one. Choose the second option to create a new site:
```bash
```bash noHeader
? What would you like to do?
⇄ Connect this directory to an existing Netlify site
+ Create & configure a new site
@@ -216,7 +216,7 @@ Youll be asked to optionally enter a site name.
At this point, the website is created on Netlify. However, Netlify needs to configure Webhooks and deployment keys. Youll be asked to either authorize GitHub through Netlifys website or through a personal access token. Youre free to choose either:
```bash
```bash noHeader
? Netlify CLI needs access to your GitHub account to configure Webhooks and Depl
oy Keys. What would you like to do? (Use arrow keys)
Authorize with GitHub through app.netlify.com
@@ -271,7 +271,7 @@ If you havent added any products to your Medusa server, the build process mig
Alternatively, you can seed the server with demo data by running this command in the root directory of the server:
```bash
```bash noHeader
medusa seed -f data/seed.json
```

View File

@@ -7,7 +7,7 @@ In this document, you will learn how to make a container of Medusa's app on Dock
### Node.js
Medusa supports Node versions 14 and 16. You can check which version of Node you have by running the following command:
```bash
```bash noHeader
node -v
```
@@ -21,18 +21,18 @@ It is assumed that you have Docker installed on your system. You can install it
### 1. Clone Medusa's starter project from GitHub
```bash
```bash noHeader
git clone https://github.com/medusajs/medusa-starter-default.git my-medusa-starter
```
### 2. Change to the newly created project directory
```bash
```bash noHeader
cd my-medusa-starter
```
### 3. Rename the environment variables(.env) file
```bash
```bash noHeader
mv .env.template .env
```
@@ -40,7 +40,7 @@ mv .env.template .env
Make sure the Docker Desktop app is running. Then, run the following command:
```bash
```bash noHeader
docker-compose up --build
```
@@ -48,7 +48,7 @@ docker-compose up --build
If you get the error `ERROR: for postgres Cannot start service postgres: Ports are not available`, change the ports used for PostgreSQL in `docker-compose.yml` to something like this:
```yml
```yml noHeader
postgres:
ports:
- "5433:5433"
@@ -68,7 +68,7 @@ Once done, your server will be accessible at `http://localhost:9000`.
You can test out your server using tools like Postman or by sending a cURL request:
```bash
```bash noHeader
curl -X GET localhost:9000/store/products | python -m json.tool
```
@@ -76,7 +76,7 @@ curl -X GET localhost:9000/store/products | python -m json.tool
This command uses Python to format the result of the request better in your command line. If you don't want to use Python you can simply send a request without the formatting:
```bash
```bash noHeader
curl localhost:9000/store/products
```

View File

@@ -6,7 +6,7 @@ This document will guide you through setting up your Medusa server in a few minu
Medusa supports Node versions 14 and 16. You can check which version of Node you have by running the following command:
```bash
```bash noHeader
node -v
```
@@ -16,7 +16,7 @@ You can install Node from the [official website](https://nodejs.org/en/).
### 1. Install Medusa CLI
```bash npm2yarn
```bash npm2yarn noHeader
npm install @medusajs/medusa-cli -g
```
@@ -28,13 +28,13 @@ If you run into any errors while installing the CLI tool, check out the [trouble
### 2. Create a new Medusa project
```bash
```bash noHeader
medusa new my-medusa-store --seed
```
### 3. Start your Medusa server
```bash
```bash noHeader
cd my-medusa-store
medusa develop
```
@@ -43,7 +43,7 @@ If you run into any errors while installing the CLI tool, check out the [trouble
After these three steps and in only a couple of minutes, you now have a complete commerce engine running locally. You can test it out by sending a request using a tool like Postman or through the command line:
```bash
```bash noHeader
curl localhost:9000/store/products | python -m json.tool
```
@@ -51,7 +51,7 @@ curl localhost:9000/store/products | python -m json.tool
This command uses Python to format the result of the request better in your command line. If you don't want to use Python you can simply send a request without the formatting:
```bash
```bash noHeader
curl localhost:9000/store/products
```

View File

@@ -19,7 +19,7 @@ You can check out more information in [NPMs documentation](https://docs.npmjs
If you install the Medusa CLI tool with Yarn, then try to use the CLI tool but get the error:
```bash
```bash noHeader
command not found: medusa
```

View File

@@ -12,7 +12,7 @@ For that reason, when the `start` and `build` scripts in `www/docs` are used, th
If you receive the following error when you run the `build` command in `www/docs`:
```bash
```bash noHeader
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
```

View File

@@ -2,7 +2,7 @@
If you're using the [S3 Plugin](../add-plugins/s3.md) and, when you upload an image, you receive the following error on your Medusa server:
```bash
```bash noHeader
AccessControlListNotSupported: The bucket does not allow ACLs
```

View File

@@ -2,7 +2,7 @@
If you've created a new Medusa server with the `--seed` option or used the `seed` script or command, the default credentials are:
```bash
```bash noHeader
email: admin@medusa-test.com
password: supersecret
```

View File

@@ -6,7 +6,7 @@ However, this comes at the expense of important features that are needed in a pr
Therefore, you might experience the following error when going through a checkout flow in one of Medusa's starters while using SQLite:
```bash
```bash noHeader
Error: Transaction already started for the given connection, commit current transaction before starting a new one.
```
@@ -46,7 +46,7 @@ medusa migrations run
If you want to add demo data into your server, you should also seed the database using the following command:
```bash npm2yarn
```bash npm2yarn noHeader
npm run seed
```

View File

@@ -18,7 +18,7 @@ Node.js is the environment that makes it possible for Medusa to run, so you must
Medusa supports versions 14 and 16 of Node.js. You can check your Node.js version using the following command:
```bash
```bash noHeader
node -v
```
@@ -118,7 +118,7 @@ The final installation required to get started with Medusa is the Medusa CLI. It
You can install Medusas CLI with the following command:
```bash npm2yarn
```bash npm2yarn noHeader
npm install @medusajs/medusa-cli -g
```

View File

@@ -1,10 +1,11 @@
.osTabs {
background-color: #f4f4f4;
background-color: var(--ifm-note-background);
padding: 10px;
border-radius: 6.4px;
color: #000;
border: 1px solid var(--ifm-note-border-color);
border-radius: var(--ifm-global-radius);
color: var(--ifm-alert-foreground-color);
}
.osTabs li:not([aria-selected=true]) {
color: #000;
color: var(--ifm-color-content);
}

View File

@@ -44,7 +44,7 @@ Youll then be asked to enter the name of the directory you want the project t
Next, youll be asked to choose the Medusa starter used to install the Medusa server. You can either pick the default Medusa starter, the Contentful starter or enter a starter URL by choosing `Other`:
```bash
```bash noHeader
? Which Medusa starter would you like to install? …
medusa-starter-default
medusa-starter-contentful
@@ -63,7 +63,7 @@ You can learn more about the Contentful starter in the [Contentful Integration d
After choosing the Medusa starter, youll be asked to choose the storefront starter. You can choose one of the starters in the list included or choose `None` to skip installing a storefront:
```bash
```bash noHeader
? Which storefront starter would you like to install?
Gatsby Starter
Next.js Starter
@@ -85,7 +85,7 @@ Learn more about the [Next.js](../starters/nextjs-medusa-starter.md) and [Gatsby
After choosing the above starters, the installation of each component will begin along with its dependencies. Once the installation is done, youll see instructions related to how to start each component.
```bash
```bash noHeader
Your project is ready. The available commands are:
Medusa API
@@ -107,7 +107,7 @@ The commands will differ based on your choices in previous prompts.
Inside the root project directory which was specified at the beginning of the installation process youll find the following directory structure:
```bash
```bash noHeader
/my-medusa-store
/storefront // Medusa storefront starter
/backend // Medusa starter as a backend option