Skip to content

Commit

Permalink
Add README
Browse files Browse the repository at this point in the history
  • Loading branch information
csauve committed Jul 31, 2015
1 parent e0bc66b commit 41e6942
Show file tree
Hide file tree
Showing 5 changed files with 162 additions and 8 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
node_modules
*.md
*.html
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2014 Connor Sauve

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
122 changes: 122 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
# Sho
A command-line tool for creating simple, self-contained HTML slideshows from Markdown documents. Use horizontal rules to separate slides:
```md
# Title Page Header
## A subheader

---

### Slide 1 Header
Bacon ipsum dolor amet [frankfurter brisket](www.example.com).
* jowl ham hock hamburger
* kielbasa shank short ribs

Short loin `spare ribs` pork doner venison.
```
![sho slides example 1](http://csauve.github.io/sho/examples/example-1.png)

## Features
* Comes pre-styled so you can concentrate on content
* [CommonMark](http://commonmark.org/) support with sensible defaults
* Code highlighting with [highlight.js](https://highlightjs.org)
* Arrow-key navigation
* Slide progress bar
* Can watch your source file for continuous editing
* Generated HTML has no external dependencies
* Text scales down for low resolution projectors and screens
* Supports background images and colours
* Included CSS for left/right floating images

## Getting Started
Requires [Node.js](https://nodejs.org/download/) to install and run:
```sh
$ npm install -g sho

# generates slides.html if slides.md is present
$ sho
# generates presentation.html
$ sho presentation.md
# or specify both paths
$ sho input.md output.html
# you can also watch files
$ sho presentation.md --watch
```
Just open the HTML file in your favourite browser and you're ready to go!

## Helpers
CommonMark allows the [inclusion of HTML tags](http://spec.commonmark.org/0.21/#html-blocks) in your markdown. Sho's stylesheet has some special classes and IDs can be used to customize your slides:

![sho slides example 1](http://csauve.github.io/sho/examples/example-2.png)

### Backgrounds
To include a **background image in all slides**, add an `img` tag with `id="background"` anywhere in your Markdown document. The `src` should be relative to the destination HTML file:
```md
<img id="background" src="images/background.jpg"/>

# Title Page
etc...
```

To include a **background image in one slide**, add an `img` tag with `class="background"` inside the slide you want affected. This background will override an all-pages background.
```md
---

<img id="background" src="images/slide5-bg.jpg"/>
### Slide 5
etc...

---
```

For a **solid colour background**, a styled span with `class="background"` or `id="background"` will behave the same way:
```md
<span id="background" style="background: #380b35"/>
# All slides are purple by default

---

<span class="background" style="background: green"/>
### Slide 1
This slide is green.
```

### Formatting
To **center-align** text, wrap it in a `class="center"` div. Don't forget to [pad inner Markdown with blank lines](http://spec.commonmark.org/0.21/#example-120):
```md
<div class="center">

by [@Author](www.author.example.io)

</div>
```

You can **left/right float images** by adding the corresponding class to an `img` tag:
```md
<img src="images/example.jpg" class="right"/>
```

## API
This module can programmatically transform Markdown files. Install the module non-globally:
```sh
npm install sho
```

Then require and call Sho:
```js
var sho = require("sho");
sho("~/docs/input.md", "~/docs/output.html");
```

## Alternatives
Sho is pretty minimal and might not fit your needs. It is inspired by [Cleaver](https://github.com/jdan/cleaver) and [reveal.js](http://lab.hakim.se/reveal-js/#/).

## Contributing
1. Fork this repo
2. Clone your fork
3. Install dependencies with `npm install`
4. Hack away!
5. Use `npm link` to test your edited Sho on the command-line
6. Commit and push changes to your fork
7. Create a pull request describing the change

License: MIT
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"url": "https://github.com/csauve/sho.git"
},
"bugs": {
"url": "https://github.com/csauve/node-greenbot/issues"
"url": "https://github.com/csauve/sho/issues"
},
"main": "sho.js",
"preferGlobal": true,
Expand Down
23 changes: 18 additions & 5 deletions style/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ body {
}
}


@media (max-width:1200px) {
body {
font-size: 18pt;
Expand Down Expand Up @@ -91,7 +90,7 @@ img.background, img#background {
@include vendor-prefix(filter, brightness(20%) contrast(85%))
}

span.background, {
span.background, span#background, {
position: fixed;
top: 0; bottom: 0; left: 0; right: 0;
z-index: -1;
Expand All @@ -102,14 +101,23 @@ img#background {
visibility: visible;
}

span#background {
z-index: -2;
visibility: visible;
}

.left {
float: left;
width: 48%;
width: 45%;
}

.right {
float: right;
width: 48%;
width: 45%;
}

.center {
text-align: center;
}

// standard elements
Expand All @@ -126,7 +134,7 @@ h1 {
font-size: 230%;
line-height: 1.2em;
text-align: center;
margin: 3em auto 1.5em auto;
margin: 2.5em auto 1.2em auto;
}

h2 {
Expand Down Expand Up @@ -162,6 +170,7 @@ a:hover {

img {
max-width: 100%;
margin: 1em;
}

ul, ol {
Expand Down Expand Up @@ -213,6 +222,10 @@ table td, table th {
text-align: left;
}

table th {
text-decoration: underline;
}

#progress-bar {
position: fixed;
top: 0; left: 0; right: 0;
Expand Down

0 comments on commit 41e6942

Please sign in to comment.