@wordpress/docgen 1.39.0 → 1.40.0
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/lib/markdown/formatter.js +23 -1
- package/package.json +2 -2
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
const remark = require( 'remark' );
|
|
5
|
+
|
|
1
6
|
/**
|
|
2
7
|
* Internal dependencies
|
|
3
8
|
*/
|
|
@@ -68,9 +73,26 @@ const formatDeprecated = ( tags, docs ) => {
|
|
|
68
73
|
};
|
|
69
74
|
|
|
70
75
|
const formatDescription = ( description, docs ) => {
|
|
76
|
+
const processor = remark().use( () => {
|
|
77
|
+
return function transformer( tree ) {
|
|
78
|
+
tree.children.forEach( function ( node ) {
|
|
79
|
+
if ( node.children ) {
|
|
80
|
+
transformer( node );
|
|
81
|
+
}
|
|
82
|
+
if ( node.type === 'text' && node.value ) {
|
|
83
|
+
// Replace line breaks with spaces and remove line-ending hyphens.
|
|
84
|
+
node.value = node.value
|
|
85
|
+
.replace( /([A-Za-z])-\n([A-Za-z])/g, '$1$2' )
|
|
86
|
+
.replace( /\n/g, ' ' );
|
|
87
|
+
}
|
|
88
|
+
} );
|
|
89
|
+
};
|
|
90
|
+
} );
|
|
91
|
+
const processedDescription = processor.processSync( description );
|
|
92
|
+
|
|
71
93
|
docs.push( '\n' );
|
|
72
94
|
docs.push( '\n' );
|
|
73
|
-
docs.push(
|
|
95
|
+
docs.push( processedDescription );
|
|
74
96
|
};
|
|
75
97
|
|
|
76
98
|
const getHeading = ( index, text ) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/docgen",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.40.0",
|
|
4
4
|
"description": "Autogenerate public API documentation from exports and JSDoc comments.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"publishConfig": {
|
|
39
39
|
"access": "public"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "d61700b9f1c72ba0b030fc815ef1685b4f4031ec"
|
|
42
42
|
}
|