jdan / cleaver

30-second slideshows for hackers
http://jdan.github.io/cleaver
MIT License
4.03k stars 305 forks source link

cleaver.json #89

Closed jdan closed 10 years ago

jdan commented 10 years ago

A modest proposal

I'd like to start a conversation about this.

Currently, cleaver presentations contain metadata:

title: My presentation
author:
    name: Jordan Scales
    twitter: @jdan
output: talk.html
style: something.css

--

# My presentation
## It has a subtitle

This is, in my opinion, a little weird. I would like to separate documents into two parts: the actual presentation (just markdown) and a new file called cleaver.json, which may look like this:

{
  "title": "My presentation",
  "style": "something.css",
  "author": {
    "name": "Jordan Scales",
    "url": "http://jscal.es",
    "twitter": "@jdan"
  },
  "output": "talk.html"
}

I'd also like to reopen the possibility of handling command-line options (we used to do this)

cleaver presentation.md --style=something.css --output=talk.html

so you could avoid creating a cleaver.json.

Benefits

Separation of presentation content and settings. I feel like having the content and settings tightly coupled is a little counterintuitive. We could keep things more organized, which could open the door to a few new features - plugins, middleware, that sort of thing.

Downsides

No longer one file :(. The whole idea is that cleaver presentations are super portable, both when they're being creating and when they're rendered. You can still have your entire presentation contained in a single file, though, and simply use command-line options to achieve what you can now.

What are your thoughts?

Bartvds commented 10 years ago

Definitely +1

The values merge with those in the markdown. And with the option to specify the path to a config file.

Maybe even some logic to get the default title from the first level 1 header? This way we can externalise everything not specific to the presentation.

Of course I assume a config object can be passed to the node.js api?

lufengd3 commented 10 years ago

@jdan Yes, I'm truly feel unconvienent recently, the first thing I do is copy the conf metadata from README and paste when I open a markdown file. I agree with your proposal, but don't you think that makes the command-line too long with those options when user start a new markdown file. What's more, how do you handle the cleaver.json which each markdown file has one? It makes things a little complex in my mind.


My proposal:

cleaver init filename.md

With this option, when you start a new file, add the conf metadata at new file's begining. If the file alearedy exists, just append the conf metadata at the begining.

jdan commented 10 years ago

Good idea @keith3, there's some work being done in #70 for that

sudodoki commented 10 years ago

If you use cleaver.json it would mean you cannot have all your presentation in single folder, but rather have each wrapped in folder with .md & .json file in it. Not sure it's a frequent use-case, but it's thing worth mentioning.

jdan commented 10 years ago

Yeah, not a fan of this after thinking about it more. Thanks for chiming in.