@mui/internal-markdown 1.0.19 → 1.0.21
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 +42 -43
- 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.21",
|
|
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": "^
|
|
21
|
+
"marked": "^15.0.2",
|
|
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) {
|
|
@@ -175,66 +181,59 @@ ${headers.hooks
|
|
|
175
181
|
});
|
|
176
182
|
|
|
177
183
|
// fragment link symbol
|
|
178
|
-
rendered.unshift(
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
</svg>`,
|
|
184
|
-
);
|
|
184
|
+
rendered.unshift(`<svg style="display: none;" xmlns="http://www.w3.org/2000/svg">
|
|
185
|
+
<symbol id="comment-link-icon" viewBox="0 0 24 24">
|
|
186
|
+
<path d="M22.8481 4C22.8481 2.9 21.9481 2 20.8481 2H4.84814C3.74814 2 2.84814 2.9 2.84814 4V16C2.84814 17.1 3.74814 18 4.84814 18H18.8481L22.8481 22V4ZM16.8481 11H13.8481V14C13.8481 14.55 13.3981 15 12.8481 15C12.2981 15 11.8481 14.55 11.8481 14V11H8.84814C8.29814 11 7.84814 10.55 7.84814 10C7.84814 9.45 8.29814 9 8.84814 9H11.8481V6C11.8481 5.45 12.2981 5 12.8481 5C13.3981 5 13.8481 5.45 13.8481 6V9H16.8481C17.3981 9 17.8481 9.45 17.8481 10C17.8481 10.55 17.3981 11 16.8481 11Z" />
|
|
187
|
+
</symbol>
|
|
188
|
+
</svg>`);
|
|
185
189
|
|
|
186
|
-
rendered.unshift(
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
</svg>`,
|
|
192
|
-
);
|
|
190
|
+
rendered.unshift(`<svg style="display: none;" xmlns="http://www.w3.org/2000/svg">
|
|
191
|
+
<symbol id="anchor-link-icon" viewBox="0 0 12 6">
|
|
192
|
+
<path d="M8.9176 0.083252H7.1676C6.84677 0.083252 6.58427 0.345752 6.58427 0.666585C6.58427 0.987419 6.84677 1.24992 7.1676 1.24992H8.9176C9.8801 1.24992 10.6676 2.03742 10.6676 2.99992C10.6676 3.96242 9.8801 4.74992 8.9176 4.74992H7.1676C6.84677 4.74992 6.58427 5.01242 6.58427 5.33325C6.58427 5.65409 6.84677 5.91659 7.1676 5.91659H8.9176C10.5276 5.91659 11.8343 4.60992 11.8343 2.99992C11.8343 1.38992 10.5276 0.083252 8.9176 0.083252ZM3.6676 2.99992C3.6676 3.32075 3.9301 3.58325 4.25094 3.58325H7.75094C8.07177 3.58325 8.33427 3.32075 8.33427 2.99992C8.33427 2.67909 8.07177 2.41659 7.75094 2.41659H4.25094C3.9301 2.41659 3.6676 2.67909 3.6676 2.99992ZM4.83427 4.74992H3.08427C2.12177 4.74992 1.33427 3.96242 1.33427 2.99992C1.33427 2.03742 2.12177 1.24992 3.08427 1.24992H4.83427C5.1551 1.24992 5.4176 0.987419 5.4176 0.666585C5.4176 0.345752 5.1551 0.083252 4.83427 0.083252H3.08427C1.47427 0.083252 0.167603 1.38992 0.167603 2.99992C0.167603 4.60992 1.47427 5.91659 3.08427 5.91659H4.83427C5.1551 5.91659 5.4176 5.65409 5.4176 5.33325C5.4176 5.01242 5.1551 4.74992 4.83427 4.74992Z" />
|
|
193
|
+
</symbol>
|
|
194
|
+
</svg>`);
|
|
193
195
|
|
|
194
|
-
rendered.unshift(
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
</svg>`,
|
|
200
|
-
);
|
|
196
|
+
rendered.unshift(`<svg style="display: none;" xmlns="http://www.w3.org/2000/svg">
|
|
197
|
+
<symbol id="copy-icon" viewBox="0 0 24 24">
|
|
198
|
+
<path d="M15 20H5V7c0-.55-.45-1-1-1s-1 .45-1 1v13c0 1.1.9 2 2 2h10c.55 0 1-.45 1-1s-.45-1-1-1zm5-4V4c0-1.1-.9-2-2-2H9c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h9c1.1 0 2-.9 2-2zm-2 0H9V4h9v12z" />
|
|
199
|
+
+</symbol>
|
|
200
|
+
</svg>`);
|
|
201
201
|
|
|
202
|
-
rendered.unshift(
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
</svg>`);
|
|
202
|
+
rendered.unshift(`<svg style="display: none;" xmlns="http://www.w3.org/2000/svg">
|
|
203
|
+
<symbol id="copied-icon" viewBox="0 0 24 24">
|
|
204
|
+
<path d="M20 2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-8.24 11.28L9.69 11.2c-.38-.39-.38-1.01 0-1.4.39-.39 1.02-.39 1.41 0l1.36 1.37 4.42-4.46c.39-.39 1.02-.39 1.41 0 .38.39.38 1.01 0 1.4l-5.13 5.17c-.37.4-1.01.4-1.4 0zM3 6c-.55 0-1 .45-1 1v13c0 1.1.9 2 2 2h13c.55 0 1-.45 1-1s-.45-1-1-1H5c-.55 0-1-.45-1-1V7c0-.55-.45-1-1-1z" />
|
|
205
|
+
</symbol>
|
|
206
|
+
</svg>`);
|
|
208
207
|
|
|
209
208
|
// icons for callout (info, success, warning, error)
|
|
210
209
|
|
|
211
210
|
rendered.unshift(
|
|
212
211
|
`<svg style="display: none;" xmlns="http://www.w3.org/2000/svg">
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
212
|
+
<symbol id="info-icon" viewBox="0 0 20 20">
|
|
213
|
+
<path d="M9.996 14c.21 0 .39-.072.535-.216a.72.72 0 0 0 .219-.534v-3.5a.728.728 0 0 0-.214-.534.72.72 0 0 0-.532-.216.734.734 0 0 0-.535.216.72.72 0 0 0-.219.534v3.5c0 .213.071.39.214.534a.72.72 0 0 0 .532.216Zm0-6.5c.21 0 .39-.071.535-.214a.714.714 0 0 0 .219-.532.736.736 0 0 0-.214-.535.714.714 0 0 0-.532-.219.736.736 0 0 0-.535.214.714.714 0 0 0-.219.532c0 .21.071.39.214.535.143.146.32.219.532.219Zm.01 10.5a7.81 7.81 0 0 1-3.11-.625 8.065 8.065 0 0 1-2.552-1.719 8.066 8.066 0 0 1-1.719-2.551A7.818 7.818 0 0 1 2 9.99c0-1.104.208-2.14.625-3.105a8.066 8.066 0 0 1 4.27-4.26A7.818 7.818 0 0 1 10.009 2a7.75 7.75 0 0 1 3.106.625 8.083 8.083 0 0 1 4.26 4.265A7.77 7.77 0 0 1 18 9.994a7.81 7.81 0 0 1-.625 3.11 8.066 8.066 0 0 1-1.719 2.552 8.083 8.083 0 0 1-2.546 1.719 7.77 7.77 0 0 1-3.104.625Z"/>
|
|
214
|
+
</symbol>
|
|
215
|
+
</svg>`,
|
|
217
216
|
);
|
|
218
217
|
rendered.unshift(
|
|
219
218
|
`<svg style="display: none;" xmlns="http://www.w3.org/2000/svg">
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
219
|
+
<symbol id="success-icon" viewBox="0 0 20 20">
|
|
220
|
+
<path d="m8.938 10.875-1.25-1.23a.718.718 0 0 0-.521-.228.718.718 0 0 0-.521.229.73.73 0 0 0 0 1.062l1.77 1.771c.153.153.327.23.521.23a.718.718 0 0 0 .521-.23l3.896-3.896a.73.73 0 0 0 0-1.062.718.718 0 0 0-.52-.23.718.718 0 0 0-.521.23l-3.376 3.354ZM10 18a7.796 7.796 0 0 1-3.104-.625 8.065 8.065 0 0 1-2.552-1.719 8.064 8.064 0 0 1-1.719-2.552A7.797 7.797 0 0 1 2 10c0-1.111.208-2.15.625-3.115a8.064 8.064 0 0 1 4.27-4.26A7.797 7.797 0 0 1 10 2c1.111 0 2.15.208 3.115.625a8.096 8.096 0 0 1 4.26 4.26C17.792 7.851 18 8.89 18 10a7.797 7.797 0 0 1-.625 3.104 8.066 8.066 0 0 1-4.26 4.271A7.774 7.774 0 0 1 10 18Z"/>
|
|
221
|
+
</symbol>
|
|
222
|
+
</svg>`,
|
|
224
223
|
);
|
|
225
224
|
rendered.unshift(
|
|
226
225
|
`<svg style="display: none;" xmlns="http://www.w3.org/2000/svg">
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
226
|
+
<symbol id="warning-icon" viewBox="0 0 20 20">
|
|
227
|
+
<path d="M2.33 17a.735.735 0 0 1-.665-.375.631.631 0 0 1-.094-.375.898.898 0 0 1 .115-.396L9.353 3.062a.621.621 0 0 1 .281-.27.85.85 0 0 1 .729 0 .622.622 0 0 1 .281.27l7.667 12.792c.07.125.108.257.114.396a.63.63 0 0 1-.093.375.842.842 0 0 1-.271.27.728.728 0 0 1-.394.105H2.33Zm7.664-2.5c.211 0 .39-.072.536-.214a.714.714 0 0 0 .218-.532.736.736 0 0 0-.214-.535.714.714 0 0 0-.531-.22.736.736 0 0 0-.536.215.714.714 0 0 0-.219.531c0 .212.072.39.215.536.143.146.32.219.531.219Zm0-2.5c.211 0 .39-.072.536-.216a.72.72 0 0 0 .218-.534v-2.5a.728.728 0 0 0-.214-.534.72.72 0 0 0-.531-.216.734.734 0 0 0-.536.216.72.72 0 0 0-.219.534v2.5c0 .212.072.39.215.534a.72.72 0 0 0 .531.216Z"/>
|
|
228
|
+
</symbol>
|
|
229
|
+
</svg>`,
|
|
231
230
|
);
|
|
232
231
|
rendered.unshift(
|
|
233
232
|
`<svg style="display: none;" xmlns="http://www.w3.org/2000/svg">
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
233
|
+
<symbol id="error-icon" viewBox="0 0 20 20">
|
|
234
|
+
<path fill-rule="evenodd" d="M2 7.4v5.2a2 2 0 0 0 .586 1.414l3.4 3.4A2 2 0 0 0 7.4 18h5.2a2 2 0 0 0 1.414-.586l3.4-3.4A2 2 0 0 0 18 12.6V7.4a2 2 0 0 0-.586-1.414l-3.4-3.4A2 2 0 0 0 12.6 2H7.4a2 2 0 0 0-1.414.586l-3.4 3.4A2 2 0 0 0 2 7.4Zm11.03-.43a.75.75 0 0 1 0 1.06L11.06 10l1.97 1.97a.75.75 0 1 1-1.06 1.06L10 11.06l-1.97 1.97a.75.75 0 0 1-1.06-1.06L8.94 10 6.97 8.03a.75.75 0 0 1 1.06-1.06L10 8.94l1.97-1.97a.75.75 0 0 1 1.06 0Z" clip-rule="evenodd"/>
|
|
235
|
+
</symbol>
|
|
236
|
+
</svg>`,
|
|
238
237
|
);
|
|
239
238
|
docs[userLanguage] = {
|
|
240
239
|
description,
|
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)
|