docs: fix code block titles (#5733)

* docs: fix code block titles

* remove console

* fix build error
This commit is contained in:
Shahed Nasser
2023-11-27 16:08:10 +00:00
committed by GitHub
parent de8f748674
commit 547b16ead5
110 changed files with 483 additions and 456 deletions
@@ -111,7 +111,7 @@ Where `<YOUR_SEGMENT_WRITE_KEY>` is the Write Key shown on the page of the Segme
Finally, in `medusa-config.js`, add the following new item to the `plugins` array:
```jsx title=medusa-config.js
```jsx title="medusa-config.js"
const plugins = [
// ...
{
@@ -155,7 +155,7 @@ In some cases, you might want to track more events or custom events. You can do
For example, you can add the following [subscriber](../../development/events/subscribers.mdx) to listen to the `customer.created` event and add tracking for every customer created:
```ts title=src/subscribers/customer.ts
```ts title="src/subscribers/customer.ts"
import {
type SubscriberConfig,
type SubscriberArgs,
@@ -38,7 +38,7 @@ npm install medusa-plugin-contentful
Next, add the plugin into the `plugins` array in `medusa-config.js`:
```js title=medusa-config.js
```js title="medusa-config.js"
const plugins = [
// ...
{
@@ -76,7 +76,7 @@ When the plugin syncs data between Contentful and Medusa, it expects a set of fi
For example, to change the name of the products `title` field, pass the following option to the plugin:
```js title=medusa-config.js
```js title="medusa-config.js"
const plugins = [
// ...
{
@@ -168,7 +168,7 @@ npm install --save-dev contentful-migration
Create the file `src/loaders/contentful-migrations/product.ts` with the following content:
```ts title=src/loaders/contentful-migrations/product.ts
```ts title="src/loaders/contentful-migrations/product.ts"
import Migration, {
MigrationContext,
} from "contentful-migration"
@@ -247,7 +247,7 @@ npm install --save-dev contentful-migration
Create the file `src/loaders/contentful-migrations/product-variant.ts` with the following content:
```ts title=src/loaders/contentful-migrations/product-variant.ts
```ts title="src/loaders/contentful-migrations/product-variant.ts"
import Migration, {
MigrationContext,
} from "contentful-migration"
@@ -292,7 +292,7 @@ npm install --save-dev contentful-migration
Create the file `src/loaders/contentful-migrations/product-collection.ts` with the following content:
```ts title=src/loaders/contentful-migrations/product-collection.ts
```ts title="src/loaders/contentful-migrations/product-collection.ts"
import Migration, {
MigrationContext,
} from "contentful-migration"
@@ -325,7 +325,7 @@ npm install --save-dev contentful-migration
Create the file `src/loaders/contentful-migrations/product-type.ts` with the following content:
```ts title=src/loaders/contentful-migrations/product-type.ts
```ts title="src/loaders/contentful-migrations/product-type.ts"
import Migration, {
MigrationContext,
} from "contentful-migration"
@@ -358,7 +358,7 @@ npm install --save-dev contentful-migration
Create the file `src/loaders/contentful-migrations/region.ts` with the following content:
```ts title=src/loaders/contentful-migrations/region.ts
```ts title="src/loaders/contentful-migrations/region.ts"
import Migration, {
MigrationContext,
} from "contentful-migration"
@@ -404,7 +404,7 @@ npm install --save-dev contentful-migration
Finally, create a [loader](../../development/loaders/overview.mdx) at `src/loaders/index.ts` with the following content:
```ts title=src/loaders/index.ts
```ts title="src/loaders/index.ts"
import {
ConfigModule,
StoreService,
+1 -1
View File
@@ -146,7 +146,7 @@ Where:
Finally, open `medusa-config.js` and add the following new item to the `plugins` array:
```jsx title=medusa-config.js
```jsx title="medusa-config.js"
const plugins = [
// ...
{
@@ -40,7 +40,7 @@ npm install medusa-plugin-brightpearl
Finally, add the plugin to the `plugins` array in `medusa-config.js`:
```js title=medusa-config.js
```js title="medusa-config.js"
const plugins = [
// ...
{
@@ -37,7 +37,7 @@ npm install @medusajs/file-local
Then, configure your `medusa-config.js` to include the plugin with the required options:
```js title=medusa-config.js
```js title="medusa-config.js"
const plugins = [
// ...
{
@@ -80,7 +80,7 @@ If this configuration is not added, youll receive the error ["next/image Un-c
In `next.config.js` add the following option in the exported object:
```js title=next.config.js
```js title="next.config.js"
const { withStoreConfig } = require("./store-config")
// ...
@@ -92,7 +92,7 @@ Where `<ENDPOINT>` is the URL of your MinIO backend, `<BUCKET>` is the name of t
Finally, configure your `medusa-config.js` to include the plugin with the required options:
```js title=medusa-config.js
```js title="medusa-config.js"
const plugins = [
// ...
{
@@ -147,7 +147,7 @@ MINIO_PRIVATE_BUCKET=exports
Then, add a new option to the plugins options in `medusa-config.js`:
```jsx title=medusa-config.js
```jsx title="medusa-config.js"
const plugins = [
// ...
{
@@ -175,7 +175,7 @@ Where `<YOUR_PRIVATE_ACCESS_KEY>` and `<YOUR_PRIVATE_SECRET_KEY>` are the access
Then, add two new options to the plugins options in `medusa-config.js`:
```jsx title=medusa-config.js
```jsx title="medusa-config.js"
const plugins = [
// ...
{
@@ -201,7 +201,7 @@ If this configuration is not added, youll receive the error ["next/image Un-c
In `next.config.js` add the following option in the exported object:
```jsx title=next.config.js
```jsx title="next.config.js"
const { withStoreConfig } = require("./store-config")
// ...
@@ -106,7 +106,7 @@ npm install medusa-file-s3
Then, in `medusa-config.js`, add to the `plugins` array the following new item:
```jsx title=medusa-config.js
```jsx title="medusa-config.js"
const plugins = [
// ...
{
@@ -164,7 +164,7 @@ You can pass additional AWS configurations, such as `customUserAgent`, in the pl
For example:
```jsx title=medusa-config.js
```jsx title="medusa-config.js"
const plugins = [
// ...
{
@@ -212,7 +212,7 @@ If this configuration is not added, youll receive the error ["next/image Un-c
In `next.config.js` add the following option in the exported object:
```jsx title=next.config.js
```jsx title="next.config.js"
const { withStoreConfig } = require("./store-config")
// ...
@@ -108,7 +108,7 @@ Where:
Finally, in `medusa-config.js` add a new item to the `plugins` array:
```jsx title=medusa-config.js
```jsx title="medusa-config.js"
const plugins = [
// ...
{
@@ -160,7 +160,7 @@ If this configuration is not added, youll receive the error ["next/image Un-
In `next.config.js` add the following option in the exported object:
```jsx title=next.config.js
```jsx title="next.config.js"
const { withStoreConfig } = require("./store-config")
// ...
@@ -30,7 +30,7 @@ npm install medusa-fulfillment-manual
Finally, add the plugin to the `plugins` array in `medusa-config.js`:
```js title=medusa-config.js
```js title="medusa-config.js"
const plugins = [
// ...
{
@@ -36,7 +36,7 @@ npm install medusa-fulfillment-webshipper
Next, add the plugin to the `plugins` array in `medusa-config.js`:
```js title=medusa-config.js
```js title="medusa-config.js"
const plugins = [
// ...
{
@@ -62,7 +62,7 @@ Make sure to replace `<YOUR_API_KEY>` with your API Key and `<YOUR_NEWSLETTER_LI
Open `medusa-config.js` and add the new plugin into the `plugins` array:
```js title=medusa-config.js
```js title="medusa-config.js"
const plugins = [
// ...,
{
@@ -123,7 +123,7 @@ To subscribe users to the newsletter without using this API Route or at a specif
Heres an example of using the `mailchimpService` in an API Route:
```ts title=src/api/store/subscribe/route.ts
```ts title="src/api/store/subscribe/route.ts"
import type {
MedusaRequest,
MedusaResponse,
@@ -3943,7 +3943,7 @@ Where `<ORDER_PLACED_TEMPLATE_ID` is the ID of your template for order placed em
Finally, in your `medusa-config.js` file, add the SendGrid plugin into the array of plugins:
```js title=medusa-config.js
```js title="medusa-config.js"
const plugins = [
// ...,
{
@@ -4000,7 +4000,7 @@ You can resolve the SendGrid service to send emails from your custom services or
For example, in an API Route:
```ts title=src/api/store/email/route.ts
```ts title="src/api/store/email/route.ts"
import type {
MedusaRequest,
MedusaResponse,
@@ -78,7 +78,7 @@ npm install medusa-plugin-slack-notification
After that, open `medusa-config.js` and add the new plugin with its configurations in the `plugins` array:
```js title=medusa-config.js
```js title="medusa-config.js"
const plugins = [
// ...,
{
@@ -55,7 +55,7 @@ Make sure to replace `<YOUR_ACCOUNT_SID>`, `<YOUR_AUTH_TOKEN>`, and `<YOUR_TWILI
Finally, add the plugin and its options in the `medusa-config.js` file to the `plugins` array:
```js title=medusa-config.js
```js title="medusa-config.js"
const plugins = [
// ...
{
@@ -85,7 +85,7 @@ For this example to work, you'll need to have an [event bus module](../../develo
Create the file `src/subscriber/sms.ts` in your Medusa backend with the following content:
```ts title=src/subscriber/sms.ts
```ts title="src/subscriber/sms.ts"
import {
type SubscriberConfig,
type SubscriberArgs,
@@ -30,7 +30,7 @@ npm install medusa-plugin-discount-generator
Finally, add the plugin to the `plugins` array in `medusa-config.js`:
```js title=medusa-config.js
```js title="medusa-config.js"
const plugins = [
// ...
{
@@ -65,7 +65,7 @@ The `DiscountGeneratorService` has one method `generateDiscount`. This method re
Here's an example of using the service in an API Route:
```ts title=src/api/store/generate-discount-code/route.ts
```ts title="src/api/store/generate-discount-code/route.ts"
import type {
MedusaRequest,
MedusaResponse,
@@ -44,7 +44,7 @@ Where `<YOUR_ACCESS_KEY>` is your ipstack accounts access key. Its availab
Finally, add the IP lookup plugin into the plugins array exported as part of the Medusa configuration in `medusa-config.js`:
```js title=medusa-config.js
```js title="medusa-config.js"
const plugins = [
// other plugins...
{
@@ -80,7 +80,7 @@ You can learn more about creating an API Route [here](../../development/api-rout
:::
```ts title=src/api/store/customer-region/route.ts
```ts title="src/api/store/customer-region/route.ts"
import type {
MedusaRequest,
MedusaResponse,
@@ -124,7 +124,7 @@ For example, you can attach it to all `/store` routes to ensure the customers
<!-- eslint-disable @typescript-eslint/no-var-requires -->
```ts title=src/api/middlewares.ts
```ts title="src/api/middlewares.ts"
import type { MiddlewaresConfig } from "@medusajs/medusa"
const { preCartCreation } = require(
"medusa-plugin-ip-lookup/api/medusa-middleware"
@@ -44,7 +44,7 @@ npm install medusa-plugin-restock-notification
Then, add the plugin into the plugins array exported as part of the Medusa configuration in `medusa-config.js`:
```js title=medusa-config.js
```js title="medusa-config.js"
const plugins = [
// other plugins...
{
@@ -116,7 +116,7 @@ The SendGrid plugin already listens to and handles the `restock-notification.res
Here's an example of a [subscriber](../../development/events/subscribers.mdx) that listens to the `restock-notification.restocked` event and uses the [SendGrid plugin](../notifications/sendgrid.mdx) to send the subscribed customers an email:
```ts title=src/subscribers/restock-notification.ts
```ts title="src/subscribers/restock-notification.ts"
import {
type SubscriberConfig,
type SubscriberArgs,
@@ -37,7 +37,7 @@ npm install medusa-plugin-wishlist
Finally, add the plugin to the `plugins` array in `medusa-config.js`:
```js title=medusa-config.js
```js title="medusa-config.js"
const plugins = [
// ...
{
@@ -64,7 +64,7 @@ Where:
Finally, in `medusa-config.js`, add the Klarna plugin to the `plugins` array with the necessary configurations:
```js title=medusa-config.js
```js title="medusa-config.js"
const plugins = [
// other plugins...
{
@@ -62,7 +62,7 @@ Notice that during development its highly recommended to set `PAYPAL_SANDBOX`
Then, in `medusa-config.js`, add the PayPal plugin to the `plugins` array with the configurations necessary:
```js title=medusa-config.js
```js title="medusa-config.js"
const plugins = [
// other plugins...
{
@@ -138,7 +138,7 @@ Medusa has a Next.js Starter Template that you can easily use with your Medusa b
In your `.env.local` file (or the file youre using for your environment variables), add the following variable:
```bash title=.env.local
```bash title=".env.local"
NEXT_PUBLIC_PAYPAL_CLIENT_ID=<YOUR_CLIENT_ID>
```
@@ -54,7 +54,7 @@ Next, you need to add configurations for your stripe plugin.
In `medusa-config.js` add the following at the end of the `plugins` array:
```js title=medusa-config.js
```js title="medusa-config.js"
const plugins = [
// ...
{
@@ -145,7 +145,7 @@ Medusa has a Next.js Starter Template that you can easily use with your Medusa b
In your `.env.local` file (or the file youre using for your environment variables), add the following variable:
```bash title=.env.local
```bash title=".env.local"
NEXT_PUBLIC_STRIPE_KEY=<YOUR_PUBLISHABLE_KEY>
```
@@ -92,7 +92,7 @@ Where `<YOUR_APP_ID>` and `<YOUR_ADMIN_API_KEY>` are respectively the Applicatio
Finally, in `medusa-config.js` add the following item into the `plugins` array:
```js title=medusa-config.js
```js title="medusa-config.js"
const plugins = [
// ...
{
@@ -151,7 +151,7 @@ These settings are just examples of what you can pass to the Algolia provider. I
Here's an example of the settings you can use:
```js title=medusa-config.js
```js title="medusa-config.js"
const plugins = [
// ...
{
@@ -243,7 +243,7 @@ The Next.js Starter Template has the Algolia integration available out of the bo
First, ensure that the search feature is enabled in `store.config.json`:
```json title=store.config.json
```json title="store.config.json"
{
"features": {
"search": true
@@ -263,7 +263,7 @@ Where `<YOUR_APP_ID>` and `<YOUR_SEARCH_API_KEY>` are respectively the Applicati
Finally, change the code in `src/lib/search-client.ts` to the following:
```ts title=src/lib/search-client.ts
```ts title="src/lib/search-client.ts"
import algoliasearch from "algoliasearch/lite"
const appId = process.env.NEXT_PUBLIC_SEARCH_APP_ID || ""
@@ -52,7 +52,7 @@ Where `<YOUR_MEILISEARCH_HOST>` is the host of your MeiliSearch instance. By def
Finally, in `medusa-config.js` add the following item into the `plugins` array:
```js title=medusa-config.js
```js title="medusa-config.js"
const plugins = [
// ...
{
@@ -76,7 +76,7 @@ const plugins = [
Under the `settings` key of the plugin's options, you can add settings specific to each index. The settings are of the following format:
```js title=medusa-config.js
```js title="medusa-config.js"
const plugins = [
// ...
{
@@ -117,7 +117,7 @@ These settings are just examples of what you can pass to the MeiliSearch provide
Here's an example of the settings you can use:
```js title=medusa-config.js
```js title="medusa-config.js"
const plugins = [
// ...
{
@@ -223,7 +223,7 @@ The Next.js Starter Template has the MeiliSearch integration available out of th
First, ensure that the search feature is enabled in `store.config.json`:
```json title=store.config.json
```json title="store.config.json"
{
"features": {
"search": true
@@ -63,7 +63,7 @@ Where:
Finally, add the plugin to the `plugins` array in `medusa-config.js`:
```js title=medusa-config.js
```js title="medusa-config.js"
const plugins = [
// ...,
{