@wordpress/docgen 1.39.0 → 1.41.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/get-jsdoc-from-token.js +12 -2
- package/lib/markdown/formatter.js +23 -1
- package/package.json +2 -2
|
@@ -28,9 +28,19 @@ module.exports = ( token ) => {
|
|
|
28
28
|
let paramCount = 0;
|
|
29
29
|
|
|
30
30
|
jsdoc.tags = jsdoc.tags.map( ( tag ) => {
|
|
31
|
+
const isParam = tag.tag === 'param';
|
|
31
32
|
const isUnqualifiedParam =
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
isParam && ! tag.name.includes( '.' );
|
|
34
|
+
let index = isUnqualifiedParam ? paramCount++ : paramCount;
|
|
35
|
+
|
|
36
|
+
// Qualified parameters come after an unqualified parameter. When
|
|
37
|
+
// the paramCount is incremented for an unqualified parameter, we
|
|
38
|
+
// still need to access that previous index. In other words, the
|
|
39
|
+
// qualified parameter types exist at the index of the previous
|
|
40
|
+
// unqualified parameter. As a result, the index is actually less.
|
|
41
|
+
if ( isParam && index > 0 && ! isUnqualifiedParam ) {
|
|
42
|
+
index -= 1;
|
|
43
|
+
}
|
|
34
44
|
|
|
35
45
|
return {
|
|
36
46
|
...tag,
|
|
@@ -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.41.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": "6df0c62d43b8901414ccd22ffbe56eaa99d012a6"
|
|
42
42
|
}
|