Ejemplo n.º 1
0
          bar = barrier(function(){

            var surroundedMarkdown = MD_PREFIX + markdownContent + MD_POSTFIX,
                filledInMarkdown = Handlebars.compile(surroundedMarkdown)(opts),
                html = supermarked(filledInMarkdown, MARKDOWN_OPTS),
                $ = postProcessMarkup(cheerio.load(html)),
                response = outline($);

            response.status = requestedMarkdownExists? 200 : 404;
             
            if( !requestedMarkdownExists ) {
               console.log('no such markdown file:'.red, markdownFile(requestedPage));
            }
             
            callback( response );
         });
Ejemplo n.º 2
0
#!/usr/bin/env node

var fs = require('fs');
var marker = require('supermarked');

//read styles and math script
var css = fs.readFileSync(__dirname + '/../lib/style.css', "utf8");

//read input file
var input_filename = process.argv[2]
var input_file = fs.readFileSync(process.argv[2], "utf8");

//construct html file
var html = '<style>' + css + '</style>';
html += '<meta charset=utf-8>';
html += '<article>' + marker(input_file, {tables: true}) + '</article>';

//write file to stdout
console.log(html);