@mui/internal-markdown 1.0.19 → 1.0.20
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 +2 -2
- package/parseMarkdown.js +0 -7
- package/prepareMarkdown.js +6 -0
- package/prepareMarkdown.test.js +14 -14
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/internal-markdown",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.20",
|
|
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",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@babel/runtime": "^7.26.0",
|
|
20
20
|
"lodash": "^4.17.21",
|
|
21
|
-
"marked": "^14.1.
|
|
21
|
+
"marked": "^14.1.4",
|
|
22
22
|
"prismjs": "^1.29.0"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
package/parseMarkdown.js
CHANGED
|
@@ -7,15 +7,8 @@ const prism = require('./prism');
|
|
|
7
7
|
*/
|
|
8
8
|
const markedOptions = {
|
|
9
9
|
gfm: true,
|
|
10
|
-
tables: true,
|
|
11
10
|
breaks: false,
|
|
12
11
|
pedantic: false,
|
|
13
|
-
sanitize: false,
|
|
14
|
-
smartLists: true,
|
|
15
|
-
smartypants: false,
|
|
16
|
-
headerPrefix: false,
|
|
17
|
-
headerIds: false,
|
|
18
|
-
mangle: false,
|
|
19
12
|
};
|
|
20
13
|
|
|
21
14
|
const headerRegExp = /---[\r\n]([\s\S]*)[\r\n]---/;
|
package/prepareMarkdown.js
CHANGED
|
@@ -102,6 +102,12 @@ function prepareMarkdown(config) {
|
|
|
102
102
|
);
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
+
if (description.slice(-1) !== '.' && description.slice(-1) !== '!') {
|
|
106
|
+
throw new Error(
|
|
107
|
+
`docs-infra: The description "${description}" should end with a "." or "!", those are sentences.`,
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
|
|
105
111
|
const contents = getContents(markdown);
|
|
106
112
|
|
|
107
113
|
if (headers.unstyled) {
|
package/prepareMarkdown.test.js
CHANGED
|
@@ -13,7 +13,7 @@ describe('prepareMarkdown', () => {
|
|
|
13
13
|
const markdown = `
|
|
14
14
|
# Support
|
|
15
15
|
|
|
16
|
-
<p class="description">Foo
|
|
16
|
+
<p class="description">Foo.</p>
|
|
17
17
|
|
|
18
18
|
## Community help (free)
|
|
19
19
|
### GitHub <img src="/static/images/logos/github.svg" width="24" height="24" alt="GitHub logo" loading="lazy" />
|
|
@@ -64,7 +64,7 @@ describe('prepareMarkdown', () => {
|
|
|
64
64
|
const markdown = `
|
|
65
65
|
# Theming
|
|
66
66
|
|
|
67
|
-
<p class="description">Foo
|
|
67
|
+
<p class="description">Foo.</p>
|
|
68
68
|
|
|
69
69
|
## API
|
|
70
70
|
### responsiveFontSizes(theme, options) => theme
|
|
@@ -105,7 +105,7 @@ describe('prepareMarkdown', () => {
|
|
|
105
105
|
const markdownEn = `
|
|
106
106
|
# Localization
|
|
107
107
|
|
|
108
|
-
<p class="description">Foo
|
|
108
|
+
<p class="description">Foo.</p>
|
|
109
109
|
|
|
110
110
|
## Locales
|
|
111
111
|
### Example
|
|
@@ -115,7 +115,7 @@ describe('prepareMarkdown', () => {
|
|
|
115
115
|
const markdownPt = `
|
|
116
116
|
# Localização
|
|
117
117
|
|
|
118
|
-
<p class="description">Foo
|
|
118
|
+
<p class="description">Foo.</p>
|
|
119
119
|
|
|
120
120
|
## Idiomas
|
|
121
121
|
### Exemplo
|
|
@@ -125,7 +125,7 @@ describe('prepareMarkdown', () => {
|
|
|
125
125
|
const markdownZh = `
|
|
126
126
|
# 所在位置
|
|
127
127
|
|
|
128
|
-
<p class="description">Foo
|
|
128
|
+
<p class="description">Foo.</p>
|
|
129
129
|
|
|
130
130
|
## 语言环境
|
|
131
131
|
### 例
|
|
@@ -211,7 +211,7 @@ describe('prepareMarkdown', () => {
|
|
|
211
211
|
const markdownEn = `
|
|
212
212
|
# Localization
|
|
213
213
|
|
|
214
|
-
<p class="description">Foo
|
|
214
|
+
<p class="description">Foo.</p>
|
|
215
215
|
|
|
216
216
|
## Locales
|
|
217
217
|
### Example
|
|
@@ -221,7 +221,7 @@ describe('prepareMarkdown', () => {
|
|
|
221
221
|
const markdownPt = `
|
|
222
222
|
# Localização
|
|
223
223
|
|
|
224
|
-
<p class="description">Foo
|
|
224
|
+
<p class="description">Foo.</p>
|
|
225
225
|
|
|
226
226
|
## Idiomas
|
|
227
227
|
### Exemplo
|
|
@@ -292,7 +292,7 @@ describe('prepareMarkdown', () => {
|
|
|
292
292
|
const markdown = `
|
|
293
293
|
# Localization
|
|
294
294
|
|
|
295
|
-
<p class="description">Foo
|
|
295
|
+
<p class="description">Foo.</p>
|
|
296
296
|
|
|
297
297
|
[bar](/bar/)
|
|
298
298
|
[foo](/foo)
|
|
@@ -314,7 +314,7 @@ See https://ahrefs.com/blog/trailing-slash/ for more details.
|
|
|
314
314
|
const markdown = `
|
|
315
315
|
# Localization
|
|
316
316
|
|
|
317
|
-
<p class="description">Foo
|
|
317
|
+
<p class="description">Foo.</p>
|
|
318
318
|
|
|
319
319
|
[bar](/bar/)
|
|
320
320
|
[foo](foo/)
|
|
@@ -334,7 +334,7 @@ See https://ahrefs.com/blog/trailing-slash/ for more details.
|
|
|
334
334
|
const markdown = `
|
|
335
335
|
# Foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
|
|
336
336
|
|
|
337
|
-
<p class="description">Foo
|
|
337
|
+
<p class="description">Foo.</p>
|
|
338
338
|
|
|
339
339
|
`;
|
|
340
340
|
|
|
@@ -354,7 +354,7 @@ https://developers.google.com/search/docs/advanced/appearance/title-link
|
|
|
354
354
|
const markdown = `
|
|
355
355
|
# Foo
|
|
356
356
|
|
|
357
|
-
<p class="description">
|
|
357
|
+
<p class="description">Foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo.</p>
|
|
358
358
|
|
|
359
359
|
`;
|
|
360
360
|
|
|
@@ -364,7 +364,7 @@ https://developers.google.com/search/docs/advanced/appearance/title-link
|
|
|
364
364
|
translations: [{ filename: 'index.md', markdown, userLanguage: 'en' }],
|
|
365
365
|
});
|
|
366
366
|
}).to
|
|
367
|
-
.throw(`docs-infra: The description "
|
|
367
|
+
.throw(`docs-infra: The description "Foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo." is too long (188 characters).
|
|
368
368
|
It needs to have fewer than 170 characters—ideally less than 160. For more details, see:
|
|
369
369
|
https://ahrefs.com/blog/meta-description/#4-be-concise
|
|
370
370
|
`);
|
|
@@ -374,7 +374,7 @@ https://ahrefs.com/blog/meta-description/#4-be-concise
|
|
|
374
374
|
const markdown = `
|
|
375
375
|
# Foo
|
|
376
376
|
|
|
377
|
-
<p class="description">Fo
|
|
377
|
+
<p class="description">Fo.</p>
|
|
378
378
|
|
|
379
379
|
\`\`\`sh
|
|
380
380
|
npm install @mui/material
|
|
@@ -401,7 +401,7 @@ Use "bash" instead.
|
|
|
401
401
|
const markdown = `
|
|
402
402
|
# Localization
|
|
403
403
|
|
|
404
|
-
<p class="description">Foo
|
|
404
|
+
<p class="description">Foo.</p>
|
|
405
405
|
|
|
406
406
|
[foo](/foo/)
|
|
407
407
|
[bar](/bar//#foo)
|