@ng-doc/utils 15.10.3 → 15.10.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/README.md +1 -1
- package/index.js +7 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<br />
|
|
7
7
|
<div align="center">
|
|
8
8
|
<a href="https://github.com/skoropadas/ng-doc">
|
|
9
|
-
<img src="https://ng-doc.com/assets/images/ng-doc.svg" alt="Logo" height="100px">
|
|
9
|
+
<img src="https://ng-doc.com/assets/images/ng-doc.svg?raw=true" alt="Logo" height="100px">
|
|
10
10
|
</a>
|
|
11
11
|
|
|
12
12
|
<h3 align="center">NgDoc</h3>
|
package/index.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import twig from 'highlight.js/lib/languages/twig';
|
|
2
|
-
import { rehype } from 'rehype';
|
|
3
2
|
import rehypeFormat from 'rehype-format';
|
|
4
3
|
import rehypeHighlight from 'rehype-highlight';
|
|
5
4
|
import rehypeMinifyWhitespace from 'rehype-minify-whitespace';
|
|
5
|
+
import rehypeParse from 'rehype-parse';
|
|
6
|
+
import rehypeStringify from 'rehype-stringify';
|
|
7
|
+
import { unified } from 'unified';
|
|
6
8
|
import { isElement } from 'hast-util-is-element';
|
|
7
9
|
import { visit } from 'unist-util-visit';
|
|
8
10
|
import { NG_DOC_ELEMENT } from '@ng-doc/core/constants/defaults.js';
|
|
@@ -13,6 +15,7 @@ import { asArray } from '@ng-doc/core/helpers/as-array.js';
|
|
|
13
15
|
import GithubSlugger from 'github-slugger';
|
|
14
16
|
import { hasProperty } from 'hast-util-has-property';
|
|
15
17
|
import { headingRank } from 'hast-util-heading-rank';
|
|
18
|
+
import { rehype } from 'rehype';
|
|
16
19
|
import { filter } from 'unist-util-filter';
|
|
17
20
|
|
|
18
21
|
/**
|
|
@@ -236,7 +239,9 @@ function sluggerPlugin(headings) {
|
|
|
236
239
|
* @param config
|
|
237
240
|
*/
|
|
238
241
|
async function htmlPostProcessor(html, config) {
|
|
239
|
-
return
|
|
242
|
+
return unified().use(rehypeParse, {
|
|
243
|
+
fragment: true
|
|
244
|
+
}).use(rehypeStringify).use(rehypeFormat).use(rehypeHighlight, {
|
|
240
245
|
ignoreMissing: true,
|
|
241
246
|
languages: {
|
|
242
247
|
twig
|