@ng-doc/utils 18.0.3 → 18.0.8

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.
@@ -0,0 +1,5 @@
1
+ /**
2
+ *
3
+ * @param html
4
+ */
5
+ export declare function minify(html: string): string;
package/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export * from './html/minify';
1
2
  export * from './html/post-process-html';
2
3
  export * from './html/process-html';
3
4
  export * from './html/remove-not-indexable-content';
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).use(rehypeShiki, {
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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ng-doc/utils",
3
- "version": "18.0.3",
3
+ "version": "18.0.8",
4
4
  "type": "module",
5
5
  "dependencies": {
6
6
  "rehype": "13.0.1",