summaryrefslogtreecommitdiff
path: root/packages/integrations/mdx/src
diff options
context:
space:
mode:
authorGravatar Ben Holmes <hey@bholmes.dev> 2023-01-18 17:04:37 -0500
committerGravatar GitHub <noreply@github.com> 2023-01-18 17:04:37 -0500
commit05caf445d4d2728f1010aeb2179a9e756c2fd17d (patch)
tree8a266974e6f19db4a2437677f1d0043c3b3345bf /packages/integrations/mdx/src
parent599a05bfb528e69190d158cbe58417da198de3dd (diff)
downloadastro-05caf445d4d2728f1010aeb2179a9e756c2fd17d.tar.gz
astro-05caf445d4d2728f1010aeb2179a9e756c2fd17d.tar.zst
astro-05caf445d4d2728f1010aeb2179a9e756c2fd17d.zip
Cleanup deprecated Markdown APIs from 0.X (#5891)
* chore: remove deprecated `getHeaders()` * chore: remove `rawContent()` and `compiledContent()` * chore: remove raw and compiled content from MDX type * chore: remove 0.X error for `astro` property * chore: changeset * lint: no empty interface * chore: update changeset
Diffstat (limited to 'packages/integrations/mdx/src')
-rw-r--r--packages/integrations/mdx/src/index.ts16
-rw-r--r--packages/integrations/mdx/src/plugins.ts16
2 files changed, 0 insertions, 32 deletions
diff --git a/packages/integrations/mdx/src/index.ts b/packages/integrations/mdx/src/index.ts
index 756e6d24f..577d073ee 100644
--- a/packages/integrations/mdx/src/index.ts
+++ b/packages/integrations/mdx/src/index.ts
@@ -12,12 +12,6 @@ import type { Plugin as VitePlugin } from 'vite';
import { getRehypePlugins, getRemarkPlugins, recmaInjectImportMetaEnvPlugin } from './plugins.js';
import { getFileInfo, parseFrontmatter } from './utils.js';
-const RAW_CONTENT_ERROR =
- 'MDX does not support rawContent()! If you need to read the Markdown contents to calculate values (ex. reading time), we suggest injecting frontmatter via remark plugins. Learn more on our docs: https://docs.astro.build/en/guides/integrations-guide/mdx/#inject-frontmatter-via-remark-or-rehype-plugins';
-
-const COMPILED_CONTENT_ERROR =
- 'MDX does not support compiledContent()! If you need to read the HTML contents to calculate values (ex. reading time), we suggest injecting frontmatter via rehype plugins. Learn more on our docs: https://docs.astro.build/en/guides/integrations-guide/mdx/#inject-frontmatter-via-remark-or-rehype-plugins';
-
export type MdxOptions = Omit<typeof markdownConfigDefaults, 'remarkPlugins' | 'rehypePlugins'> & {
extendMarkdownConfig: boolean;
recmaPlugins: PluggableList;
@@ -123,16 +117,6 @@ export default function mdx(partialMdxOptions: Partial<MdxOptions> = {}): AstroI
if (!moduleExports.includes('file')) {
code += `\nexport const file = ${JSON.stringify(fileId)};`;
}
- if (!moduleExports.includes('rawContent')) {
- code += `\nexport function rawContent() { throw new Error(${JSON.stringify(
- RAW_CONTENT_ERROR
- )}) };`;
- }
- if (!moduleExports.includes('compiledContent')) {
- code += `\nexport function compiledContent() { throw new Error(${JSON.stringify(
- COMPILED_CONTENT_ERROR
- )}) };`;
- }
if (!moduleExports.includes('Content')) {
// Make `Content` the default export so we can wrap `MDXContent` and pass in `Fragment`
code = code.replace('export default MDXContent;', '');
diff --git a/packages/integrations/mdx/src/plugins.ts b/packages/integrations/mdx/src/plugins.ts
index 6b97bc77c..8c98e0016 100644
--- a/packages/integrations/mdx/src/plugins.ts
+++ b/packages/integrations/mdx/src/plugins.ts
@@ -79,22 +79,6 @@ export function rehypeApplyFrontmatterExport() {
const { layout, ...content } = frontmatter;
content.file = file;
content.url = url;
- content.astro = {};
- Object.defineProperty(content.astro, 'headings', {
- get() {
- throw new Error('The "astro" property is no longer supported! To access "headings" from your layout, try using "Astro.props.headings."')
- }
- });
- Object.defineProperty(content.astro, 'html', {
- get() {
- throw new Error('The "astro" property is no longer supported! To access "html" from your layout, try using "Astro.props.compiledContent()."')
- }
- });
- Object.defineProperty(content.astro, 'source', {
- get() {
- throw new Error('The "astro" property is no longer supported! To access "source" from your layout, try using "Astro.props.rawContent()."')
- }
- });
return layoutJsx(Layout, {
file,
url,