Skip to content

Commit

Permalink
Revert " feat(remix-dev): add support for handle, links & `loader…
Browse files Browse the repository at this point in the history
…` to mdx (#3763)"

This reverts commit b2ef490.
  • Loading branch information
kentcdodds committed Jul 19, 2022
1 parent f3595ab commit e2149af
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 120 deletions.
6 changes: 0 additions & 6 deletions .changeset/tender-impalas-invite.md

This file was deleted.

1 change: 0 additions & 1 deletion contributors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -394,4 +394,3 @@
- zhe
- garand
- kiancross
- tagraves
7 changes: 1 addition & 6 deletions docs/guides/mdx.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Remix supports using MDX in two ways:

The simplest way to get started with MDX in Remix is to create a route module. Just like `.js` and `.ts` files in your `app/routes` directory, `.mdx` (and `.md`) files will participate in automatic file system based routing.

MDX routes allow you to define `handle`, `headers`, `links`, and `meta` as if they were a code based route:
MDX routes allow you to define both meta and headers as if they were a code based route:

```md
---
Expand All @@ -25,9 +25,6 @@ meta:
description: Isn't this awesome?
headers:
Cache-Control: no-cache
links: [{ rel: "stylesheet", href: "app.css" }]
handle:
someData: "abc"
---

# Hello Content!
Expand All @@ -50,8 +47,6 @@ import SomeComponent from "~/components/some-component";
<SomeComponent {...attributes.componentData} />
```

You can also access your frontmatter fields from a parent component via the `data` field in `useMatches`.

### Example

By creating a `app/routes/posts/first-post.mdx` we can start writing a blog post:
Expand Down
104 changes: 0 additions & 104 deletions integration/mdx-test.ts

This file was deleted.

4 changes: 1 addition & 3 deletions packages/remix-dev/compiler/plugins/mdx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,7 @@ export function mdxPlugin(config: RemixConfig): esbuild.Plugin {
export const filename = ${JSON.stringify(path.basename(args.path))};
export const headers = typeof attributes !== "undefined" && attributes.headers;
export const meta = typeof attributes !== "undefined" && attributes.meta;
export const handle = typeof attributes !== "undefined" && attributes.handle;
export const links = typeof attributes === "undefined" ? undefined : () => attributes.links;
export const loader = typeof attributes === "undefined" ? undefined : () => attributes;
export const links = undefined;
`;

let compiled = await xdm.compile(fileContents, {
Expand Down

0 comments on commit e2149af

Please sign in to comment.