deckdown icon indicating copy to clipboard operation
deckdown copied to clipboard

Pass markdown filename in via command line

Open earth2marsh opened this issue 11 years ago • 2 comments

I should be able to run node deckdown.js {preso_name} where preso_name is the markdown file to convert. The HTML should be saved alongside the preso name in the same dir.

Also consider renaming /pres to /presentations or decks.

earth2marsh avatar Sep 12 '14 20:09 earth2marsh

marsh, can you work on that? That seems like a different path from the express API that I've been working on so far. CLI Branch?

13protons avatar Sep 26 '14 14:09 13protons

Hey guys,

I like what you're working on. I tweaked some command-line code I already had. Maybe a head start? Anyways, good luck.

$ node deckdown.js 
Please provide a markdown presentation (e.g. node [path/to/]deckdown.js [path/to/]presentation.md)
$ node deckdown.js markdown.md 
# Presentation Slide Title

deckdown.js

var arguments = process.argv.slice(2),
    preso_name = arguments[0] || '';

if(preso_name) {
    var path = require('path'),
        fs = require('fs');

    try {
        var preso_markdown = fs.readFileSync(path.resolve(preso_name), 'utf-8');
        console.log(preso_markdown);
    } catch(error) {
        console.error(new Date().toUTCString() + ' caughtException:', error.message);
        console.error(error.stack);
    }
} else {
    console.error('Please provide a markdown presentation (e.g. node [path/to/]deckdown.js [path/to/]presentation.md)');
}

markdown.md

# Presentation Slide Title

ttahmouch avatar Sep 26 '14 16:09 ttahmouch