Skip to content

Commit

Permalink
[core] Remove warnings in docs:api (#37858)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfauquette authored Jul 12, 2023
1 parent 9df27d0 commit 54c4992
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
2 changes: 1 addition & 1 deletion docs/scripts/reportBrokenLinks.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const getPageLinks = (markdown) => {
hrefs.push(href);
}
};
marked(markdown, { renderer });
marked(markdown, { mangle: false, headerIds: false, renderer });
return hrefs;
};

Expand Down
34 changes: 18 additions & 16 deletions packages/markdown/parseMarkdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,22 @@ const kebabCase = require('lodash/kebabCase');
const textToHash = require('./textToHash');
const prism = require('./prism');

/**
* Option used by `marked` the library parsing markdown.
*/
const markedOptions = {
gfm: true,
tables: true,
breaks: false,
pedantic: false,
sanitize: false,
smartLists: true,
smartypants: false,
headerPrefix: false,
headerIds: false,
mangle: false,
};

const headerRegExp = /---[\r\n]([\s\S]*)[\r\n]---/;
const titleRegExp = /# (.*)[\r\n]/;
const descriptionRegExp = /<p class="description">(.*?)<\/p>/s;
Expand Down Expand Up @@ -188,7 +204,7 @@ function getDescription(markdown) {
* @param {string} markdown
*/
function renderInline(markdown) {
return marked.parseInline(markdown);
return marked.parseInline(markdown, markedOptions);
}

// Help rank mui.com on component searches first.
Expand Down Expand Up @@ -352,20 +368,6 @@ function createRender(context) {
].join('')}\n`;
};

const markedOptions = {
gfm: true,
tables: true,
breaks: false,
pedantic: false,
sanitize: false,
smartLists: true,
smartypants: false,
headerPrefix: false,
headerIds: false,
mangle: false,
renderer,
};

marked.use({
extensions: [
{
Expand Down Expand Up @@ -401,7 +403,7 @@ function createRender(context) {
],
});

return marked(markdown, markedOptions);
return marked(markdown, { ...markedOptions, renderer });
}

return render;
Expand Down

0 comments on commit 54c4992

Please sign in to comment.