@mui/internal-docs-infra 0.3.1-canary.1 → 0.3.1-canary.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -35,15 +35,9 @@ export interface SitemapPage {
35
35
  exports?: Record<string, SitemapExport>;
36
36
  tags?: string[];
37
37
  skipDetailSection?: boolean;
38
- openGraph?: {
39
- title?: string;
40
- description?: string;
41
- images?: Array<{
42
- url: string;
43
- width: number;
44
- height: number;
45
- alt: string;
46
- }>;
38
+ image?: {
39
+ url: string;
40
+ alt?: string;
47
41
  };
48
42
  }
49
43
  /**
@@ -68,7 +68,6 @@ function _mergeMetadataMarkdown() {
68
68
  _step2,
69
69
  existingPage,
70
70
  newPage,
71
- _newPage$openGraph,
72
71
  descriptionMarkdown,
73
72
  existingPageWithoutDescriptionMarkdown,
74
73
  merged,
@@ -148,11 +147,7 @@ function _mergeMetadataMarkdown() {
148
147
  // Preserve skipDetailSection from existing (user-managed for external links)
149
148
  skipDetailSection: existingPage.skipDetailSection,
150
149
  // Preserve sections from existing if new doesn't have them
151
- sections: newPage.sections || existingPage.sections,
152
- // Merge openGraph, but ensure description comes from newPage if it has one
153
- openGraph: (_newPage$openGraph = newPage.openGraph) != null ? _newPage$openGraph : newPage.description ? _extends(_extends({}, existingPage.openGraph), {}, {
154
- description: newPage.description
155
- }) : existingPage.openGraph
150
+ sections: newPage.sections || existingPage.sections
156
151
  });
157
152
  pages.push(merged);
158
153
  addedPaths.add(newPage.path);
@@ -429,9 +429,8 @@ export function metadataToMarkdownAst(data) {
429
429
  _step5;
430
430
  try {
431
431
  for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
432
- var _page$openGraph;
433
432
  var page = _step5.value;
434
- var pageTitle = ((_page$openGraph = page.openGraph) == null ? void 0 : _page$openGraph.title) || page.title || page.slug;
433
+ var pageTitle = page.title || page.slug;
435
434
 
436
435
  // Check if this is a single-link entry (external link or no detail section)
437
436
  var isSingleLink = page.skipDetailSection || false;
@@ -511,13 +510,12 @@ export function metadataToMarkdownAst(data) {
511
510
  _step6;
512
511
  try {
513
512
  for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
514
- var _page$openGraph2, _page$openGraph3, _page$openGraph4;
515
513
  var _page = _step6.value;
516
- var _pageTitle = ((_page$openGraph2 = _page.openGraph) == null ? void 0 : _page$openGraph2.title) || _page.title || _page.slug;
514
+ var _pageTitle = _page.title || _page.slug;
517
515
  // Note: We don't replace newlines here to allow natural line breaks in detailed sections
518
- var description = ((_page$openGraph3 = _page.openGraph) == null ? void 0 : _page$openGraph3.description) || _page.description || 'No description available';
516
+ var description = _page.description || 'No description available';
519
517
  var keywords = _page.keywords || [];
520
- var image = (_page$openGraph4 = _page.openGraph) == null || (_page$openGraph4 = _page$openGraph4.images) == null ? void 0 : _page$openGraph4[0];
518
+ var image = _page.image;
521
519
 
522
520
  // Add page heading
523
521
  children.push(heading(2, _pageTitle));
@@ -800,9 +798,8 @@ export function metadataToMarkdown(data) {
800
798
  _step9;
801
799
  try {
802
800
  for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
803
- var _page$openGraph5;
804
801
  var page = _step9.value;
805
- var pageTitle = ((_page$openGraph5 = page.openGraph) == null ? void 0 : _page$openGraph5.title) || page.title || page.slug;
802
+ var pageTitle = page.title || page.slug;
806
803
 
807
804
  // Check if this is a single-link entry (external link or no detail section)
808
805
  var isSingleLink = page.skipDetailSection || false;
@@ -871,24 +868,22 @@ export function metadataToMarkdown(data) {
871
868
  _step0;
872
869
  try {
873
870
  for (_iterator0.s(); !(_step0 = _iterator0.n()).done;) {
874
- var _page2$openGraph, _page2$openGraph3;
875
871
  var _page2 = _step0.value;
876
872
  // Skip detail section for single-link entries (external links)
877
873
  if (_page2.skipDetailSection) {
878
874
  continue;
879
875
  }
880
- var _pageTitle2 = ((_page2$openGraph = _page2.openGraph) == null ? void 0 : _page2$openGraph.title) || _page2.title || _page2.slug;
876
+ var _pageTitle2 = _page2.title || _page2.slug;
881
877
  // Use descriptionMarkdown to preserve formatting if available
882
878
  // Note: We don't replace newlines here to allow natural line breaks in detailed sections
883
879
  var pageDescription = void 0;
884
880
  if (_page2.descriptionMarkdown && _page2.descriptionMarkdown.length > 0) {
885
881
  pageDescription = astNodesToMarkdown(_page2.descriptionMarkdown);
886
882
  } else {
887
- var _page2$openGraph2;
888
- pageDescription = ((_page2$openGraph2 = _page2.openGraph) == null ? void 0 : _page2$openGraph2.description) || _page2.description || 'No description available';
883
+ pageDescription = _page2.description || 'No description available';
889
884
  }
890
885
  var keywords = _page2.keywords || [];
891
- var image = (_page2$openGraph3 = _page2.openGraph) == null || (_page2$openGraph3 = _page2$openGraph3.images) == null ? void 0 : _page2$openGraph3[0];
886
+ var image = _page2.image;
892
887
 
893
888
  // Add page heading
894
889
  lines.push("## ".concat(_pageTitle2));
@@ -1164,12 +1159,7 @@ function _markdownToMetadata() {
1164
1159
  title: pageTitle,
1165
1160
  description: 'No description available',
1166
1161
  tags: tags.length > 0 ? tags : undefined,
1167
- skipDetailSection: true,
1168
- // Mark as external/single-link entry
1169
- openGraph: {
1170
- title: pageTitle,
1171
- description: 'No description available'
1172
- }
1162
+ skipDetailSection: true // Mark as external/single-link entry
1173
1163
  });
1174
1164
  } else if (links.length >= 2) {
1175
1165
  // Two-link format: - [Title](#slug) [Tag1] [Tag2] - [Full Docs](./path/page.mdx)
@@ -1221,11 +1211,7 @@ function _markdownToMetadata() {
1221
1211
  title: _pageTitle3,
1222
1212
  description: 'No description available',
1223
1213
  // Will be updated from details section
1224
- tags: _tags.length > 0 ? _tags : undefined,
1225
- openGraph: {
1226
- title: _pageTitle3,
1227
- description: 'No description available' // Will be updated from details section
1228
- }
1214
+ tags: _tags.length > 0 ? _tags : undefined
1229
1215
  });
1230
1216
  }
1231
1217
  }
@@ -1329,10 +1315,6 @@ function _markdownToMetadata() {
1329
1315
  if (_paragraphNode2.children) {
1330
1316
  currentPage.descriptionMarkdown = stripPositions(_paragraphNode2.children);
1331
1317
  }
1332
- if (!currentPage.openGraph) {
1333
- currentPage.openGraph = {};
1334
- }
1335
- currentPage.openGraph.description = _paragraphText;
1336
1318
  return;
1337
1319
  }
1338
1320
  }
@@ -1340,15 +1322,10 @@ function _markdownToMetadata() {
1340
1322
  // Parse image
1341
1323
  if (currentPage && node.type === 'image') {
1342
1324
  var imageNode = node;
1343
- if (!currentPage.openGraph) {
1344
- currentPage.openGraph = {};
1345
- }
1346
- currentPage.openGraph.images = [{
1325
+ currentPage.image = {
1347
1326
  url: imageNode.url,
1348
- width: 800,
1349
- height: 600,
1350
1327
  alt: imageNode.alt || currentPage.title || currentPage.slug || ''
1351
- }];
1328
+ };
1352
1329
  return;
1353
1330
  }
1354
1331
  }
@@ -305,8 +305,8 @@ function toPageMetadata(metadata, filePath) {
305
305
  descriptionMarkdown: (_options$visibleDescr2 = options.visibleDescriptionMarkdown) != null ? _options$visibleDescr2 : metadata.descriptionMarkdown,
306
306
  keywords: metadata.keywords,
307
307
  sections: metadata.sections,
308
- openGraph: metadata.openGraph,
309
- embeddings: metadata.embeddings
308
+ embeddings: metadata.embeddings,
309
+ image: metadata.image
310
310
  };
311
311
  }
312
312
 
@@ -720,26 +720,6 @@ export var transformMarkdownMetadata = function transformMarkdownMetadata() {
720
720
  shouldUpdateMetadata = true;
721
721
  }
722
722
 
723
- // Fill in openGraph title and description if missing
724
- if (!mutableMetadata.openGraph) {
725
- mutableMetadata.openGraph = {};
726
- }
727
- if (firstH1 && !mutableMetadata.openGraph.title) {
728
- mutableMetadata.openGraph.title = firstH1;
729
- shouldUpdateMetadata = true;
730
- }
731
-
732
- // Prioritize meta tag description over paragraph for openGraph
733
- if (!mutableMetadata.openGraph.description) {
734
- if (metaDescription) {
735
- mutableMetadata.openGraph.description = metaDescription;
736
- shouldUpdateMetadata = true;
737
- } else if (firstParagraphAfterH1) {
738
- mutableMetadata.openGraph.description = firstParagraphAfterH1;
739
- shouldUpdateMetadata = true;
740
- }
741
- }
742
-
743
723
  // Add sections hierarchy if we have headings
744
724
  hasSections = mutableMetadata.sections && Object.keys(mutableMetadata.sections).length > 0;
745
725
  if (headings.length > 1 && !hasSections) {
@@ -768,11 +748,7 @@ export var transformMarkdownMetadata = function transformMarkdownMetadata() {
768
748
  description: descriptionValue,
769
749
  descriptionMarkdown: descriptionMarkdownValue,
770
750
  keywords: metaKeywords || undefined,
771
- sections: headings.length > 1 ? buildHeadingHierarchy(headings) : undefined,
772
- openGraph: {
773
- title: firstH1 || undefined,
774
- description: descriptionValue
775
- }
751
+ sections: headings.length > 1 ? buildHeadingHierarchy(headings) : undefined
776
752
  };
777
753
 
778
754
  // Create a new metadata export and add it to the tree
@@ -863,7 +839,7 @@ export var transformMarkdownMetadata = function transformMarkdownMetadata() {
863
839
  exports: page.exports,
864
840
  tags: page.tags,
865
841
  skipDetailSection: page.skipDetailSection,
866
- openGraph: page.openGraph
842
+ image: page.image
867
843
  };
868
844
  })
869
845
  }; // Find and update the wrapper component in the AST
@@ -97,14 +97,8 @@ export interface ExtractedMetadata {
97
97
  keywords?: string[];
98
98
  sections?: HeadingHierarchy;
99
99
  embeddings?: number[];
100
- openGraph?: {
101
- title?: string;
102
- description?: string;
103
- images?: Array<{
104
- url: string;
105
- width: number;
106
- height: number;
107
- alt: string;
108
- }>;
100
+ image?: {
101
+ url: string;
102
+ alt?: string;
109
103
  };
110
104
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/internal-docs-infra",
3
- "version": "0.3.1-canary.1",
3
+ "version": "0.3.1-canary.2",
4
4
  "author": "MUI Team",
5
5
  "description": "MUI Infra - internal documentation creation tools.",
6
6
  "bin": {
@@ -329,5 +329,5 @@
329
329
  },
330
330
  "./esm": null
331
331
  },
332
- "gitSha": "04aa71c45b922602c25a926df3a7e17cb3744ac1"
332
+ "gitSha": "1ff097fa93dd7975b1282196feadba23916b2347"
333
333
  }