index.js
function(summary) {

            // If the file contains an h2, we need to reformat it
            if (summary.content.match(/^## /m)) {

                var parts = summary.content.split(/(?=##)/);
                for (var i = 0; i < parts.length; i++) {
                    // Remove any blank lines
                    parts[i] = parts[i].replace(/(\*.*)\n\n/gm, "$1\n");

                    // If the part has a heading, replace it and indent the child items in the list
                    // Mark a heading as a part by smuggling some text into the list item.
                    // Messy, but it's the only way.
                    if (parts[i].indexOf('##') == 0) {
                        parts[i] = parts[i].replace(/^([ \t]*\* .+)$/gm, "    $1")
                            .replace(/^## (.*)$/gm, "* -XPARTX-$1")
                    }
                }
                summary.content = parts.join('');
            }

            return summary;
        }
function(summary) {

            // If the file contains an h2, we need to reformat it
            if (summary.content.match(/^## /m)) {

                var parts = summary.content.split(/(?=##)/);
                for (var i = 0; i < parts.length; i++) {
                    // Remove any blank lines
                    parts[i] = parts[i].replace(/(\*.*)\n\n/gm, "$1\n");

                    // If the part has a heading, replace it and indent the child items in the list
                    // Mark a heading as a part by smuggling some text into the list item.
                    // Messy, but it's the only way.
                    if (parts[i].indexOf('##') == 0) {
                        parts[i] = parts[i].replace(/^([ \t]*\* .+)$/gm, "    $1")
                            .replace(/^## (.*)$/gm, "* -XPARTX-$1")
                    }
                }
                summary.content = parts.join('');
            }

            return summary;
        }
function ( summary ) { // If the file contains an h2, we need to reformat it if ( summary . content . match ( / ^##  / m ) ) { var parts = summary . content . split ( / (?=##) / ) ; for ( var i = 0 ; i < parts . length ; i ++ ) { // Remove any blank lines parts [ i ] = parts [ i ] . replace ( / (\*.*)\n\n / gm , "$1\n" ) ; // If the part has a heading, replace it and indent the child items in the list // Mark a heading as a part by smuggling some text into the list item. // Messy, but it's the only way. if ( parts [ i ] . indexOf ( '##' ) == 0 ) { parts [ i ] = parts [ i ] . replace ( / ^([ \t]*\* .+)$ / gm , "    $1" ) . replace ( / ^## (.*)$ / gm , "* -XPARTX-$1" ) } } summary . content = parts . join ( '' ) ; } return summary ; }
Gets plain text content
Gets plain text content