1- var mdast = require ( 'mdast ' ) ,
1+ var remark = require ( 'remark ' ) ,
22 u = require ( 'unist-builder' ) ,
33 formatType = require ( 'documentation-theme-utils' ) . formatType ,
44 formatInlineTags = require ( '../format_inline_tags' ) ,
55 hljs = require ( 'highlight.js' ) ;
66
77/**
8- * Given a hierarchy-nested set of comments, generate an mdast -compatible
8+ * Given a hierarchy-nested set of comments, generate an remark -compatible
99 * Abstract Syntax Tree usable for generating Markdown output
1010 *
1111 * @param {Array<Object> } comments nested comment
@@ -25,7 +25,7 @@ function commentsToAST(comments, opts, callback) {
2525 *
2626 * @param {number } depth nesting of the comment, starting at 1
2727 * @param {Object } comment a single comment
28- * @returns {Object } mdast -compatible AST
28+ * @returns {Object } remark -compatible AST
2929 */
3030 function generate ( depth , comment ) {
3131
@@ -37,7 +37,7 @@ function commentsToAST(comments, opts, callback) {
3737 u ( 'text' , ' ' ) ,
3838 ! ! param . type && u ( 'strong' , formatType ( param . type ) ) ,
3939 u ( 'text' , ' ' )
40- ] . concat ( mdast . parse ( formatInlineTags ( param . description ) ) . children )
40+ ] . concat ( remark . parse ( formatInlineTags ( param . description ) ) . children )
4141 . concat ( [
4242 ! ! param . default && u ( 'paragraph' , [
4343 u ( 'text' , ' (optional, default ' ) ,
@@ -74,7 +74,7 @@ function commentsToAST(comments, opts, callback) {
7474 u ( 'strong' , formatType ( property . type ) ) ,
7575 u ( 'text' , ' ' )
7676 ]
77- . concat ( mdast . parse ( formatInlineTags ( property . description ) ) . children )
77+ . concat ( remark . parse ( formatInlineTags ( property . description ) ) . children )
7878 . filter ( Boolean ) ) ,
7979 property . properties && propertyList ( property . properties )
8080 ] . filter ( Boolean ) ) ;
@@ -95,7 +95,7 @@ function commentsToAST(comments, opts, callback) {
9595 u ( 'text' , 'Returns ' ) ,
9696 u ( 'strong' , formatType ( returns . type ) ) ,
9797 u ( 'text' , ' ' )
98- ] . concat ( mdast . parse ( formatInlineTags ( returns . description ) ) . children ) ) ;
98+ ] . concat ( remark . parse ( formatInlineTags ( returns . description ) ) . children ) ) ;
9999 } ) ;
100100 }
101101
@@ -141,10 +141,10 @@ function commentsToAST(comments, opts, callback) {
141141 } ) ) ) ;
142142 }
143143
144- return [ u ( 'heading' , { depth : depth } , [ u ( 'text' , comment . name ) ] ) ]
144+ return [ u ( 'heading' , { depth : depth } , [ u ( 'text' , comment . name || '' ) ] ) ]
145145 . concat ( githubLink ( comment ) )
146146 . concat ( augmentsLink ( comment ) )
147- . concat ( mdast . parse ( formatInlineTags ( comment . description ) ) . children )
147+ . concat ( remark . parse ( formatInlineTags ( comment . description ) ) . children )
148148 . concat ( paramSection ( comment ) )
149149 . concat ( propertySection ( comment ) )
150150 . concat ( examplesSection ( comment ) )
0 commit comments