Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass markdown filename in via command line #2

Open
earth2marsh opened this issue Sep 12, 2014 · 2 comments
Open

Pass markdown filename in via command line #2

earth2marsh opened this issue Sep 12, 2014 · 2 comments

Comments

@earth2marsh
Copy link

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.

@13protons
Copy link
Owner

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?

@ttahmouch
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants