docs: add line highlight validation (#14380)

* docs: add line highlight validation

* add to all projects

* fixes

* fixes

* fix

* fixes
This commit is contained in:
Shahed Nasser authored and GitHub committed 2025-12-22 14:10:39 +02:00
1 parent 6380c1fdf4
commit cb33388202
59 files changed
+514 -243

No files matched your search

@@ -197,10 +197,10 @@ So, to add the UI route at the `localhost:9000/app/brands` path, create the file
![Directory structure of the Medusa application after adding the UI route.](https://res.cloudinary.com/dza7lstvk/image/upload/v1733472011/Medusa%20Book/brands-admin-dir-overview-3_syytld.jpg)
export const uiRouteHighlights = [
["8", "BrandsPage", "The UI route that displays a new page."],
["23", "defineRouteConfig", "Export config to add a link for the UI route in the sidebar."],
["24", "label", "The sidebar item's label."],
["25", "icon", "The sidebar item's icon."]
["10", "BrandsPage", "The UI route that displays a new page."],
["20", "defineRouteConfig", "Export config to add a link for the UI route in the sidebar."],
["21", "label", "The sidebar item's label."],
["22", "icon", "The sidebar item's icon."]
]
```tsx title="src/admin/routes/brands/page.tsx" highlights={uiRouteHighlights}
@@ -56,7 +56,7 @@ Learn how to create a middleware in the [Middlewares](../middlewares/page.mdx) c
</Note>
export const highlights = [
["10", "req.allowed", "Modify the allowed fields and relations to be retrieved"],
["9", "req.allowed", "Modify the allowed fields and relations to be retrieved"],
]
```ts title="src/api/middlewares.ts" highlights={highlights}
@@ -49,8 +49,8 @@ When you create a record of a data model that has one of another, pass the ID of
For example, assuming you have the [User and Email data models from the previous chapter](../relationships/page.mdx#one-to-one-relationship), set a user's email ID as follows:
export const hasOneHighlights = [
["4", "email_id", "The ID of the email that the user has."],
["11", "email_id", "The ID of the email that the user has."]
["4", "email", "The ID of the email that the user has."],
["11", "email", "The ID of the email that the user has."]
]
```ts highlights={hasOneHighlights}
@@ -576,7 +576,7 @@ You can also create a `listAndCount` method to retrieve the posts with paginatio
Now, you can use Query to retrieve a product and its linked post from the CMS:
export const queryHighlights = [
["3", `"cms_post"`, "The `alias` of the virtual data model in the link configuration."]
["3", `"cms_post.*"`, "The `alias` of the virtual data model in the link configuration."]
]
```ts highlights={queryHighlights}
@@ -81,7 +81,7 @@ You define a service in a `service.ts` or `service.js` file at the root of your
export const highlights = [
["4", "MedusaService", "The service factory function."],
["5", "MyCustom", "The data models to generate data-management methods for."]
["5", "Post", "The data models to generate data-management methods for."]
]
```ts title="src/modules/blog/service.ts" highlights={highlights}
+2
View File
@@ -9,6 +9,7 @@ import {
crossProjectLinksPlugin,
recmaInjectMdxDataPlugin,
remarkAttachFrontmatterDataPlugin,
validateHighlightsPlugin,
} from "remark-rehype-plugins"
import path from "path"
import redirects from "./utils/redirects.mjs"
@@ -78,6 +79,7 @@ const withMDX = mdx({
tagName: "code",
},
],
[validateHighlightsPlugin, { verbose: false }],
[rehypeSlug],
[
cloudinaryImgRehypePlugin,