Skip to content

Commit 3c31008

Browse files
bluwyematipico
authored andcommitted
Remove markdown component (#7931)
1 parent 6333651 commit 3c31008

88 files changed

Lines changed: 10 additions & 1499 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.changeset/gentle-meals-crash.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
'astro': major
3+
---
4+
5+
Remove support for `Astro.__renderMarkdown` which is used by `@astrojs/markdown-component`.
6+
7+
The `<Markdown />` component was deprecated in Astro v1 and is completely removed in v3. This integration must now be removed from your project.
8+
9+
As an alternative, you can use community packages that provide a similar component like https://github.com/natemoo-re/astro-remote instead.

.changeset/pre.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
"@astrojs/vercel": "3.7.4",
2828
"@astrojs/vue": "2.2.1",
2929
"@astrojs/internal-helpers": "0.1.1",
30-
"@astrojs/markdown-component": "1.0.5",
3130
"@astrojs/markdown-remark": "2.2.1",
3231
"@astrojs/telemetry": "2.1.1",
3332
"@astrojs/underscore-redirects": "0.2.0"

packages/astro/src/core/app/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ export class App {
8888
return createEnvironment({
8989
adapterName: this.#manifest.adapterName,
9090
logging: this.#logging,
91-
markdown: this.#manifest.markdown,
9291
mode: 'production',
9392
compressHTML: this.#manifest.compressHTML,
9493
renderers: this.#manifest.renderers,

packages/astro/src/core/app/types.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import type { MarkdownRenderingOptions } from '@astrojs/markdown-remark';
21
import type {
32
RouteData,
43
SerializedRouteData,
@@ -40,7 +39,6 @@ export type SSRManifest = {
4039
base: string;
4140
compressHTML: boolean;
4241
assetsPrefix?: string;
43-
markdown: MarkdownRenderingOptions;
4442
renderers: SSRLoadedRenderer[];
4543
/**
4644
* Map of directive name (e.g. `load`) to the directive script code

packages/astro/src/core/build/generate.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,6 @@ async function generatePath(
507507
const env = createEnvironment({
508508
adapterName: manifest.adapterName,
509509
logging,
510-
markdown: manifest.markdown,
511510
mode: opts.mode,
512511
renderers: manifest.renderers,
513512
clientDirectives: manifest.clientDirectives,
@@ -619,7 +618,6 @@ export function createBuildManifest(
619618
entryModules: Object.fromEntries(internals.entrySpecifierToBundleMap.entries()),
620619
routes: [],
621620
adapterName: '',
622-
markdown: settings.config.markdown,
623621
clientDirectives: settings.clientDirectives,
624622
compressHTML: settings.config.compressHTML,
625623
renderers,

packages/astro/src/core/build/plugins/plugin-ssr.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,6 @@ function buildManifest(
489489
base: settings.config.base,
490490
compressHTML: settings.config.compressHTML,
491491
assetsPrefix: settings.config.build.assetsPrefix,
492-
markdown: settings.config.markdown,
493492
componentMetadata: Array.from(internals.componentMetadata),
494493
renderers: [],
495494
clientDirectives: Array.from(settings.clientDirectives),

packages/astro/src/core/render/core.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ async function renderPage({ mod, renderContext, env, cookies }: RenderPage) {
4242
links: renderContext.links,
4343
styles: renderContext.styles,
4444
logging: env.logging,
45-
markdown: env.markdown,
4645
params: renderContext.params,
4746
pathname: renderContext.pathname,
4847
componentMetadata: renderContext.componentMetadata,

packages/astro/src/core/render/environment.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import type { MarkdownRenderingOptions } from '@astrojs/markdown-remark';
21
import type { AstroSettings, RuntimeMode, SSRLoadedRenderer } from '../../@types/astro';
32
import type { LogOptions } from '../logger/core.js';
43
import type { ModuleLoader } from '../module-loader';
@@ -16,10 +15,6 @@ export interface Environment {
1615
adapterName?: string;
1716
/** logging options */
1817
logging: LogOptions;
19-
/**
20-
* Used to support `Astro.__renderMarkdown` for legacy `<Markdown />` component
21-
*/
22-
markdown: MarkdownRenderingOptions;
2318
/** "development" or "production" */
2419
mode: RuntimeMode;
2520
compressHTML: boolean;

packages/astro/src/core/render/result.ts

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import type { MarkdownRenderingOptions } from '@astrojs/markdown-remark';
21
import type {
32
AstroGlobal,
43
AstroGlobalPartial,
@@ -27,10 +26,6 @@ export interface CreateResultArgs {
2726
*/
2827
ssr: boolean;
2928
logging: LogOptions;
30-
/**
31-
* Used to support `Astro.__renderMarkdown` for legacy `<Markdown />` component
32-
*/
33-
markdown: MarkdownRenderingOptions;
3429
params: Params;
3530
pathname: string;
3631
renderers: SSRLoadedRenderer[];
@@ -128,10 +123,8 @@ class Slots {
128123
}
129124
}
130125

131-
let renderMarkdown: any = null;
132-
133126
export function createResult(args: CreateResultArgs): SSRResult {
134-
const { markdown, params, request, resolve, locals } = args;
127+
const { params, request, resolve, locals } = args;
135128

136129
const url = new URL(request.url);
137130
const headers = new Headers();
@@ -222,31 +215,6 @@ export function createResult(args: CreateResultArgs): SSRResult {
222215
slots: astroSlots as unknown as AstroGlobal['slots'],
223216
};
224217

225-
Object.defineProperty(Astro, '__renderMarkdown', {
226-
// Ensure this API is not exposed to users
227-
enumerable: false,
228-
writable: false,
229-
// TODO: Remove this hole "Deno" logic once our plugin gets Deno support
230-
value: async function (content: string, opts: MarkdownRenderingOptions) {
231-
// @ts-expect-error
232-
if (typeof Deno !== 'undefined') {
233-
throw new Error('Markdown is not supported in Deno SSR');
234-
}
235-
236-
if (!renderMarkdown) {
237-
// The package is saved in this variable because Vite is too smart
238-
// and will try to inline it in buildtime
239-
let astroRemark = '@astrojs/';
240-
astroRemark += 'markdown-remark';
241-
242-
renderMarkdown = (await import(astroRemark)).renderMarkdown;
243-
}
244-
245-
const { code } = await renderMarkdown(content, { ...markdown, ...(opts ?? {}) });
246-
return code;
247-
},
248-
});
249-
250218
return Astro;
251219
},
252220
resolve,

packages/astro/src/vite-plugin-astro-server/environment.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ export function createDevelopmentEnvironment(
1717
let env = createEnvironment({
1818
adapterName: manifest.adapterName,
1919
logging,
20-
markdown: manifest.markdown,
2120
mode,
2221
// This will be overridden in the dev server
2322
renderers: [],

0 commit comments

Comments
 (0)