Giter Site home page Giter Site logo

meinto / slide-serve Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cdreier/slide-serve

0.0 2.0 1.0 6.19 MB

small presentation and dev server for simple slides, based on https://github.com/trikita/slide-html

License: MIT License

Go 26.16% CSS 6.31% JavaScript 1.08% HTML 66.45%

slide-serve's Introduction

slide-serve

i really like the idea behind slide-html and the Takahashi method

you only need to learn 5 pseudo-markdown rules and a few annotations to build a nice presentation.

for really, really fast slide-creation and iteration and a good developer-experience i created this server

please take a look at the extended example presentation from slide-html

quickstart

i added a quickstart package in the repository, with my own styles and short demos from all features

just download the latest binary for your platform from the release page, place it somewhere and start

./slide-serve -dir path/to/quickstart

and visit http://127.0.0.1:8080

features

  • just write plaintext files, no need to think about html or indents
    • you can even write more than one plaintext file, they are added in alphanumerical order
  • start with the -dev flag to auto reload the browser on that slide you just edited
    • this is just awesome!
  • add styles and background images next to your content
    • no hardcoded slide-numbers in css
    • don't count your slides, i'll do it for you ;)
  • syntax highlighter with chroma
  • use local images
  • add small javascripts for the last bits of awesomeness

your presentation

  • your slide-files must end with .md to gets loaded
  • styles.css in your presentation-root dir is automaticly added to your presentation
  • your presentation directory is routed to http://localhost:8080/static/ so you can access local images or fonts - this is important for your custom stylesheets!

syntax additions

@img/imagename.gif
@css/stylesheet.css
@js/jsfile.js
@code/language

the path is relative to your presentation directory, if you like to create an image folder it would change to @img/images/imagename.gif

with die @code annotation, the code-formatting is set for this slide

note: instead of writing the harcoded slide number, you should use the SLIDENUMBER placeholder

@code/css
.slide-SLIDENUMBER h1 { 
  color: #fff; 
  text-shadow: 1px 1px 3px #333; 
}

example slide with background image and stylesheet:

# AWESOME
.
@img/example_bg.jpg
@css/whiteHeadline.css

with the @js annotation, you can add javascript to your slide - the code will run in the moment you enter the slide.

# javascript!
@js/jsdemo.js

2 variables are available: _slide is your current slide-div, and _slideIndex - is your slide index... obviously

the jsdemo looks like

_slide.style.backgroundColor = "red"
setTimeout(() => {
  _slide.style.backgroundColor = "inherit"
}, 1000)

example presentation: https://github.com/cdreier/slide-serve/tree/master/example

to see the example presentation, just run slide-serve without any flags

syntax highlighter

i used chroma for syntax highlightning.

just tell me what language you are using on your slide (with @code/lang) and you are good to go.

with the -syntaxhl start flag you can set the highlighter theme (there is a list with all the themes). the default is monokai

example (the position of the @code annotation does not matter)

# CSS backgrounds
@code/css
  .slide-12 {
    background: url("icon.png"),
                url("bg.png");
    background-repeat: no-repeat, repeat;
    background-size: 40%, auto;
    background-position: bottom right;
  }

build your own

i used packr to embedd the html template in the binary

all the rest is basic go code, with dependencies managed by dep

useful snippets

restarting gifs

as gifs are looping in the background, this script reloads the gif every time you enter the slide

// restartGif.js
function getBackgroundImageUrl(element){
  var styles = getComputedStyle(element)
  return styles.backgroundImage.replace("url(\"", "").replace("\")", "")
}
var url = getBackgroundImageUrl(_slide)
var reloadUrl = url + "?" + Math.random()
_slide.style.backgroundImage = "url('" + reloadUrl + "')"

and in an example slide

.
@img/funnyCat.gif
@js/restartGif.js

no image scaling

in the past, i needed a down-scaling of the images - if you want to reset this behaviour, add this to your styles.css

.slide {
  background-size: unset !important;
}

add a logo on every slide

you can add more background images - so we add one default image in the styles.css

body {
  font-family: Vollkorn;
  background-color: #e2e4e6;
  background-image: url("/static/images/your_logo.png");
  background-repeat: no-repeat;
  background-position: right 10px top 10px;
  background-size: 15%, auto;
}

printing

the default print styles from slide-html are included per default, so you can print a summary of your presentation.

with the -pdf flag, the styles are changed for printing the full slides, or to export to a pdf.

if something wont fit with your presentation styles, you can overwrite the print styles:

@media print {
  @page {size: landscape}

  /* ... */

  .slide h1 {
		font-size: 8rem !important;
	}
	.slide p {
		font-size: 2rem !important;
	}

}

cli flags

-dev

  • start with -dev or -dev true to enable auto-reloading (default false)
  • still much awesome feature!

-dir

  • this is the directory of your presentation (default "example")

-port

  • http port the server is starting on (default "8080")

-syntaxhl

  • string with the highlighter theme for your code (default "monokai")

-ratio

  • slide ratio, possible values: 4x3, 16x9 or 16x10 (default "16x9")

-title

  • html title in the browser (default "Slide")

-pdf

  • overwrite the summary print styles with full slide prints (default false)

slide-serve's People

Contributors

cdreier avatar

Watchers

James Cloos avatar Tobias Meinhardt avatar

Forkers

jeroenknoops

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.