scripts/readme.js
function dummyMarkdown() {
    var codeBlock = /^```/;
    var quoteBlock = /^>/;
    var listBlock = /^\* /;

    var commentInline = '<!--.*-->';
    var codeInline = '`.+`';

    function split(content) {
        var pattern = new RegExp([commentInline, codeInline].join('|'), 'g');
        var result = null;
        var last = 0;
        var output = [];

        while ((result = pattern.exec(content)) !== null) {
            output.push({ transform: true, content: content.slice(last, result.index)});
            output.push({ transform: false, content: result[0]});
            last = pattern.lastIndex;
        }

        output.push({ transform: true, content: content.slice(last)});

        return output;
    }

    return function (input) {
        var output = [];
        var lines = input.split('\n');

        for (var l = 0; l < lines.length; l++) {
            var line = lines[l];
            var e;
            var content;

            if (codeBlock.test(line)) {
                e = l + 1;
                while (!codeBlock.test(lines[e])) {
                    e++;
                }

                output.push({ transform: false, content: lines.slice(l, e + 1).join('\n') + '\n\n' });
                l = e;
            } else if (quoteBlock.test(line)) {
                e = l + 1;
                while (quoteBlock.test(lines[e])) {
                    e++;
                }

                content = [line].concat(lines.slice(l + 1, e).map(function (nextLine) {
                    return nextLine.slice(2);
                })).join(' ') + '\n\n';

                output = output.concat(split(content));
                l = e - 1;
            } else if (listBlock.test(line)) {
                e = l + 1;
                while (lines[e] !== '') {
                    if (!listBlock.test(lines[e])) {
                        lines[e - 1] += ' ' + lines[e];
                        lines[e] = '';
                    }
                    e++;
                }

                content = lines.slice(l, e).filter(function (line) {
                    return line !== '';
                }).join('\n') + '\n';

                output = output.concat(split(content));
                l = e - 1;
            } else if (line !== '') {
                e = l + 1;
                while (lines[e] !== '') {
                    e++;
                }

                content = lines.slice(l, e).join(' ') + '\n\n';

                output = output.concat(split(content));
                l = e - 1;
            }
        }

        return output;
    };
}
function dummyMarkdown() {
    var codeBlock = /^```/;
    var quoteBlock = /^>/;
    var listBlock = /^\* /;

    var commentInline = '<!--.*-->';
    var codeInline = '`.+`';

    function split(content) {
        var pattern = new RegExp([commentInline, codeInline].join('|'), 'g');
        var result = null;
        var last = 0;
        var output = [];

        while ((result = pattern.exec(content)) !== null) {
            output.push({ transform: true, content: content.slice(last, result.index)});
            output.push({ transform: false, content: result[0]});
            last = pattern.lastIndex;
        }

        output.push({ transform: true, content: content.slice(last)});

        return output;
    }

    return function (input) {
        var output = [];
        var lines = input.split('\n');

        for (var l = 0; l < lines.length; l++) {
            var line = lines[l];
            var e;
            var content;

            if (codeBlock.test(line)) {
                e = l + 1;
                while (!codeBlock.test(lines[e])) {
                    e++;
                }

                output.push({ transform: false, content: lines.slice(l, e + 1).join('\n') + '\n\n' });
                l = e;
            } else if (quoteBlock.test(line)) {
                e = l + 1;
                while (quoteBlock.test(lines[e])) {
                    e++;
                }

                content = [line].concat(lines.slice(l + 1, e).map(function (nextLine) {
                    return nextLine.slice(2);
                })).join(' ') + '\n\n';

                output = output.concat(split(content));
                l = e - 1;
            } else if (listBlock.test(line)) {
                e = l + 1;
                while (lines[e] !== '') {
                    if (!listBlock.test(lines[e])) {
                        lines[e - 1] += ' ' + lines[e];
                        lines[e] = '';
                    }
                    e++;
                }

                content = lines.slice(l, e).filter(function (line) {
                    return line !== '';
                }).join('\n') + '\n';

                output = output.concat(split(content));
                l = e - 1;
            } else if (line !== '') {
                e = l + 1;
                while (lines[e] !== '') {
                    e++;
                }

                content = lines.slice(l, e).join(' ') + '\n\n';

                output = output.concat(split(content));
                l = e - 1;
            }
        }

        return output;
    };
}
function dummyMarkdown ( ) { var codeBlock = / ^``` / ; var quoteBlock = / ^> / ; var listBlock = / ^\*  / ; var commentInline = '<!--.*-->' ; var codeInline = '`.+`' ; function split ( content ) { var pattern = new RegExp ( [ commentInline , codeInline ] . join ( '|' ) , 'g' ) ; var result = null ; var last = 0 ; var output = [ ] ; while ( ( result = pattern . exec ( content ) ) !== null ) { output . push ( { transform : true , content : content . slice ( last , result . index ) } ) ; output . push ( { transform : false , content : result [ 0 ] } ) ; last = pattern . lastIndex ; } output . push ( { transform : true , content : content . slice ( last ) } ) ; return output ; } return function ( input ) { var output = [ ] ; var lines = input . split ( '\n' ) ; for ( var l = 0 ; l < lines . length ; l ++ ) { var line = lines [ l ] ; var e ; var content ; if ( codeBlock . test ( line ) ) { e = l + 1 ; while ( ! codeBlock . test ( lines [ e ] ) ) { e ++ ; } output . push ( { transform : false , content : lines . slice ( l , e + 1 ) . join ( '\n' ) + '\n\n' } ) ; l = e ; } else if ( quoteBlock . test ( line ) ) { e = l + 1 ; while ( quoteBlock . test ( lines [ e ] ) ) { e ++ ; } content = [ line ] . concat ( lines . slice ( l + 1 , e ) . map ( function ( nextLine ) { return nextLine . slice ( 2 ) ; } ) ) . join ( ' ' ) + '\n\n' ; output = output . concat ( split ( content ) ) ; l = e - 1 ; } else if ( listBlock . test ( line ) ) { e = l + 1 ; while ( lines [ e ] !== '' ) { if ( ! listBlock . test ( lines [ e ] ) ) { lines [ e - 1 ] += ' ' + lines [ e ] ; lines [ e ] = '' ; } e ++ ; } content = lines . slice ( l , e ) . filter ( function ( line ) { return line !== '' ; } ) . join ( '\n' ) + '\n' ; output = output . concat ( split ( content ) ) ; l = e - 1 ; } else if ( line !== '' ) { e = l + 1 ; while ( lines [ e ] !== '' ) { e ++ ; } content = lines . slice ( l , e ) . join ( ' ' ) + '\n\n' ; output = output . concat ( split ( content ) ) ; l = e - 1 ; } } return output ; } ; }
this format preprocessor is far from being full markdown, it is built to be usable for tipograph readme in the future, this may grow into full markdown support
this format preprocessor is far from being full markdown it is built to be usable for tipograph readme in the future this may grow into full markdown support