@mui/internal-markdown 1.0.4 → 1.0.6

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/internal-markdown",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "author": "MUI Team",
5
5
  "description": "MUI markdown parser. This is an internal package not meant for general use.",
6
6
  "main": "./index.js",
@@ -16,9 +16,9 @@
16
16
  "directory": "packages/markdown"
17
17
  },
18
18
  "dependencies": {
19
- "@babel/runtime": "^7.24.5",
19
+ "@babel/runtime": "^7.24.7",
20
20
  "lodash": "^4.17.21",
21
- "marked": "^5.1.2",
21
+ "marked": "^13.0.0",
22
22
  "prismjs": "^1.29.0"
23
23
  },
24
24
  "devDependencies": {
package/parseMarkdown.js CHANGED
@@ -280,6 +280,7 @@ const noSEOadvantage = [
280
280
  'https://headlessui.com/',
281
281
  'https://refine.dev/',
282
282
  'https://scaffoldhub.io/',
283
+ 'https://marmelab.com/',
283
284
  ];
284
285
 
285
286
  /**
@@ -308,12 +309,13 @@ function createRender(context) {
308
309
  */
309
310
  function render(markdown) {
310
311
  const renderer = new marked.Renderer();
311
- renderer.heading = (headingHtml, level) => {
312
+ renderer.heading = function heading({ tokens, depth: level }) {
312
313
  // Main title, no need for an anchor.
313
314
  // It adds noises to the URL.
314
315
  //
315
316
  // Small title, no need for an anchor.
316
317
  // It reduces the risk of duplicated id and it's fewer elements in the DOM.
318
+ const headingHtml = this.parser.parseInline(tokens);
317
319
  if (level === 1 || level >= 4) {
318
320
  return `<h${level}>${headingHtml}</h${level}>`;
319
321
  }
@@ -371,11 +373,12 @@ function createRender(context) {
371
373
  `</h${level}>`,
372
374
  ].join('');
373
375
  };
374
- renderer.link = (href, linkTitle, linkText) => {
376
+ renderer.link = function link({ href, title, tokens }) {
377
+ const linkText = this.parser.parseInline(tokens);
375
378
  let more = '';
376
379
 
377
- if (linkTitle) {
378
- more += ` title="${linkTitle}"`;
380
+ if (title) {
381
+ more += ` title="${title}"`;
379
382
  }
380
383
 
381
384
  if (noSEOadvantage.some((domain) => href.indexOf(domain) !== -1)) {
@@ -403,17 +406,17 @@ function createRender(context) {
403
406
 
404
407
  return `<a href="${finalHref}"${more}>${linkText}</a>`;
405
408
  };
406
- renderer.code = (code, infostring, escaped) => {
409
+ renderer.code = ({ lang, text, escaped }) => {
407
410
  // https://github.com/markedjs/marked/blob/30e90e5175700890e6feb1836c57b9404c854466/src/Renderer.js#L15
408
- const lang = (infostring || '').match(/\S*/)[0];
409
- const title = (infostring || '').match(/title="([^"]*)"/)?.[1];
410
- const out = prism(code, lang);
411
- if (out != null && out !== code) {
411
+ const langString = (lang || '').match(/\S*/)[0];
412
+ const title = (lang || '').match(/title="([^"]*)"/)?.[1];
413
+ const out = prism(text, langString);
414
+ if (out != null && out !== text) {
412
415
  escaped = true;
413
- code = out;
416
+ text = out;
414
417
  }
415
418
 
416
- code = `${code.replace(/\n$/, '')}\n`;
419
+ const code = `${text.replace(/\n$/, '')}\n`;
417
420
 
418
421
  if (!lang) {
419
422
  return `<pre><code>${escaped ? code : escape(code, true)}</code></pre>\n`;
@@ -461,9 +464,11 @@ function createRender(context) {
461
464
  ${
462
465
  ['info', 'success', 'warning', 'error'].includes(token.severity)
463
466
  ? [
467
+ '<div class="MuiCallout-icon-container">',
464
468
  '<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" data-testid="ContentCopyRoundedIcon">',
465
469
  `<use class="MuiCode-copied-icon" xlink:href="#${token.severity}-icon" />`,
466
470
  '</svg>',
471
+ '</div>',
467
472
  ].join('\n')
468
473
  : ''
469
474
  }
@@ -39,6 +39,9 @@ function resolveComponentApiUrl(productId, componentPkg, component) {
39
39
  if (componentPkg === 'mui-base' || BaseUIReexportedComponents.indexOf(component) >= 0) {
40
40
  return `/base-ui/react-${kebabCase(component)}/components-api/#${kebabCase(component)}`;
41
41
  }
42
+ if (productId === 'toolpad-core') {
43
+ return `/toolpad/core/api/${kebabCase(component)}/`;
44
+ }
42
45
  return `/${productId}/api/${kebabCase(component)}/`;
43
46
  }
44
47