mdox.js
function (text) {
      var inApiSection = false;

      return fs.createReadStream(opts.src)
        .pipe(es.split("\n"))
        .pipe(es.through(function (line) {
          // Hit the start marker.
          if (line === opts.start) {
            // Emit our line (it **is** included).
            this.emit("data", line);

            // Emit our the processed API data.
            this.emit("data", text);

            // Mark that we are **within** API section.
            inApiSection = true;
          }

          // End marker.
          if (line === opts.end) {
            // Mark that we have **exited** API section.
            inApiSection = false;
          }

          // Re-emit lines only if we are not within API section.
          if (!inApiSection) {
            this.emit("data", line);
          }
        }))
        .pipe(es.join("\n"))
        .pipe(es.wait());
    }
function (text) {
      var inApiSection = false;

      return fs.createReadStream(opts.src)
        .pipe(es.split("\n"))
        .pipe(es.through(function (line) {
          // Hit the start marker.
          if (line === opts.start) {
            // Emit our line (it **is** included).
            this.emit("data", line);

            // Emit our the processed API data.
            this.emit("data", text);

            // Mark that we are **within** API section.
            inApiSection = true;
          }

          // End marker.
          if (line === opts.end) {
            // Mark that we have **exited** API section.
            inApiSection = false;
          }

          // Re-emit lines only if we are not within API section.
          if (!inApiSection) {
            this.emit("data", line);
          }
        }))
        .pipe(es.join("\n"))
        .pipe(es.wait());
    }
function ( text ) { var inApiSection = false ; return fs . createReadStream ( opts . src ) . pipe ( es . split ( "\n" ) ) . pipe ( es . through ( function ( line ) { // Hit the start marker. if ( line === opts . start ) { // Emit our line (it **is** included). this . emit ( "data" , line ) ; // Emit our the processed API data. this . emit ( "data" , text ) ; // Mark that we are **within** API section. inApiSection = true ; } // End marker. if ( line === opts . end ) { // Mark that we have **exited** API section. inApiSection = false ; } // Re-emit lines only if we are not within API section. if ( ! inApiSection ) { this . emit ( "data" , line ) ; } } ) ) . pipe ( es . join ( "\n" ) ) . pipe ( es . wait ( ) ) ; }
Create stream for destination and insert text appropriately.
Create stream for destination and insert text appropriately .