@ng-doc/utils 18.0.3 → 18.0.4
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/html/minify.d.ts +5 -0
- package/index.d.ts +1 -0
- package/index.esm.js +16 -3
- package/package.json +1 -1
package/html/minify.d.ts
ADDED
package/index.d.ts
CHANGED
package/index.esm.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import rehypeMinifyWhitespace from 'rehype-minify-whitespace';
|
|
1
2
|
import rehypeParse from 'rehype-parse';
|
|
2
3
|
import rehypeStringify from 'rehype-stringify';
|
|
3
4
|
import { unified } from 'unified';
|
|
@@ -6,7 +7,6 @@ import { isElement as isElement$1 } from 'hast-util-is-element';
|
|
|
6
7
|
import { toString } from 'hast-util-to-string';
|
|
7
8
|
import { visitParents, SKIP } from 'unist-util-visit-parents';
|
|
8
9
|
import rehypeShiki from '@shikijs/rehype';
|
|
9
|
-
import rehypeMinifyWhitespace from 'rehype-minify-whitespace';
|
|
10
10
|
import { visit } from 'unist-util-visit';
|
|
11
11
|
import GithubSlugger from 'github-slugger';
|
|
12
12
|
import { hasProperty } from 'hast-util-has-property';
|
|
@@ -15,6 +15,16 @@ import { rehype } from 'rehype';
|
|
|
15
15
|
import { filter } from 'unist-util-filter';
|
|
16
16
|
import { stringifyEntities as stringifyEntities$1 } from 'stringify-entities';
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* @param html
|
|
21
|
+
*/
|
|
22
|
+
function minify(html) {
|
|
23
|
+
return unified().use(rehypeParse, {
|
|
24
|
+
fragment: true
|
|
25
|
+
}).use(rehypeStringify).use(rehypeMinifyWhitespace).processSync(html).toString();
|
|
26
|
+
}
|
|
27
|
+
|
|
18
28
|
/**
|
|
19
29
|
*
|
|
20
30
|
* @param node
|
|
@@ -410,7 +420,10 @@ async function processHtml(html, config) {
|
|
|
410
420
|
try {
|
|
411
421
|
const content = await unified().use(rehypeParse, {
|
|
412
422
|
fragment: true
|
|
413
|
-
}).use(rehypeStringify).use(mermaidPlugin)
|
|
423
|
+
}).use(rehypeStringify).use(mermaidPlugin)
|
|
424
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
425
|
+
// @ts-ignore
|
|
426
|
+
.use(rehypeShiki, {
|
|
414
427
|
defaultLanguage: 'ts',
|
|
415
428
|
fallbackLanguage: 'text',
|
|
416
429
|
addLanguageClass: true,
|
|
@@ -487,4 +500,4 @@ function stringifyEntities(content) {
|
|
|
487
500
|
return stringifyEntities$1(content);
|
|
488
501
|
}
|
|
489
502
|
|
|
490
|
-
export { postProcessHtml, processHtml, removeNotIndexableContent, replaceKeywords, stringifyEntities };
|
|
503
|
+
export { minify, postProcessHtml, processHtml, removeNotIndexableContent, replaceKeywords, stringifyEntities };
|