Skip to content

Commit 2cf116f

Browse files
Remove deprecated APIs from @astrojs/markdown-remark (#10629)
Co-authored-by: Florian Lefebvre <contact@florian-lefebvre.dev>
1 parent 374efcd commit 2cf116f

7 files changed

Lines changed: 23 additions & 81 deletions

File tree

.changeset/khaki-otters-return.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@astrojs/markdown-remark": major
3+
---
4+
5+
Removes deprecated APIs including `remarkShiki`, `remarkPrism`, `replaceCssVariables` and several unused types

packages/astro/src/@types/astro.ts

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ import type { OutgoingHttpHeaders } from 'node:http';
22
import type { AddressInfo } from 'node:net';
33
import type {
44
MarkdownHeading,
5-
MarkdownMetadata,
6-
MarkdownRenderingResult,
5+
MarkdownVFile,
76
RehypePlugins,
87
RemarkPlugins,
98
RemarkRehype,
@@ -45,8 +44,6 @@ export { type AstroIntegrationLogger };
4544

4645
export type {
4746
MarkdownHeading,
48-
MarkdownMetadata,
49-
MarkdownRenderingResult,
5047
RehypePlugins,
5148
RemarkPlugins,
5249
ShikiConfig,
@@ -2188,6 +2185,21 @@ export interface ManifestData {
21882185
routes: RouteData[];
21892186
}
21902187

2188+
/** @deprecated Type is no longer used by exported APIs */
2189+
export interface MarkdownMetadata {
2190+
headings: MarkdownHeading[];
2191+
source: string;
2192+
html: string;
2193+
}
2194+
2195+
/** @deprecated Type is no longer used by exported APIs */
2196+
export interface MarkdownRenderingResult {
2197+
metadata: MarkdownMetadata;
2198+
vfile: MarkdownVFile;
2199+
code: string;
2200+
}
2201+
2202+
/** @deprecated Type is no longer used by exported APIs */
21912203
export interface MarkdownParserResponse extends MarkdownRenderingResult {
21922204
frontmatter: MD['frontmatter'];
21932205
}

packages/markdown/remark/src/index.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ export { rehypeHeadingIds } from './rehype-collect-headings.js';
2626
export { remarkCollectImages } from './remark-collect-images.js';
2727
export { rehypePrism } from './rehype-prism.js';
2828
export { rehypeShiki } from './rehype-shiki.js';
29-
export { remarkPrism } from './remark-prism.js';
30-
export { remarkShiki } from './remark-shiki.js';
31-
export { createShikiHighlighter, replaceCssVariables, type ShikiHighlighter } from './shiki.js';
29+
export { createShikiHighlighter, type ShikiHighlighter } from './shiki.js';
3230
export * from './types.js';
3331

3432
export const markdownConfigDefaults: Required<AstroMarkdownOptions> = {

packages/markdown/remark/src/remark-prism.ts

Lines changed: 0 additions & 22 deletions
This file was deleted.

packages/markdown/remark/src/remark-shiki.ts

Lines changed: 0 additions & 24 deletions
This file was deleted.

packages/markdown/remark/src/shiki.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,6 @@ function normalizePropAsString(value: Properties[string]): string | null {
167167
return Array.isArray(value) ? value.join(' ') : (value as string | null);
168168
}
169169

170-
/**
171-
* shiki -> shikiji compat as we need to manually replace it
172-
* @internal Exported for error overlay use only
173-
*/
174-
export function replaceCssVariables(str: string) {
170+
function replaceCssVariables(str: string) {
175171
return str.replace(COLOR_REPLACEMENT_REGEX, (match) => ASTRO_COLOR_REPLACEMENTS[match] || match);
176172
}

packages/markdown/remark/src/types.ts

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,6 @@ export interface AstroMarkdownOptions {
5353
smartypants?: boolean;
5454
}
5555

56-
export interface ImageMetadata {
57-
src: string;
58-
width: number;
59-
height: number;
60-
type: string;
61-
}
62-
6356
export interface MarkdownProcessor {
6457
render: (
6558
content: string,
@@ -83,31 +76,15 @@ export interface MarkdownProcessorRenderResult {
8376
};
8477
}
8578

86-
export interface MarkdownRenderingOptions
87-
extends AstroMarkdownOptions,
88-
MarkdownProcessorRenderOptions {}
89-
9079
export interface MarkdownHeading {
9180
depth: number;
9281
slug: string;
9382
text: string;
9483
}
9584

96-
export interface MarkdownMetadata {
97-
headings: MarkdownHeading[];
98-
source: string;
99-
html: string;
100-
}
101-
10285
export interface MarkdownVFile extends VFile {
10386
data: {
10487
__astroHeadings?: MarkdownHeading[];
10588
imagePaths?: Set<string>;
10689
};
10790
}
108-
109-
export interface MarkdownRenderingResult {
110-
metadata: MarkdownMetadata;
111-
vfile: MarkdownVFile;
112-
code: string;
113-
}

0 commit comments

Comments
 (0)