Code Monkey home page Code Monkey logo

termnote's Introduction

TermNote

TermNote is a program that allows you to write presentations either in Ruby:

require 'termnote'

include TermNote

show.add chapter title: "Hello, World"
show.add code language: "ruby", source: <<-SOURCE
  puts "Hello, world!"
SOURCE
show.start

Or via a .yaml file:

---
type: chapter
title: Hello, World
subtitle: By Kurtis
---
type: code
source: |
  puts "Hello, world!"

and then with the termnote binary:

$ termnote someshow.yml

Here's an example of the slides in use:

Chapter Text List Code

You can then use j or k to navigate through the slides.

Installation

Install it yourself via:

$ gem install termnote

Usage

Usage is pretty simple, there are 4 types of slides:

  • Chapter, a single title [optional: and subtitle]
  • Text, a blob of text called content [optional: and title]
  • List, a list of items [optional: and title]
  • Code, a syntax highlighted blob called source

You can change the way things are printed out by overriding the classes for your specific presentation, but only if you do things programatically.

Ruby Usage Examples

Add a title slide

show.add chapter title: "Title Slide"

Add a text slide

show.add text title: "Content Title", content: "content blob"

Add a list slide

show.add list title: "title", items: ["item 1", "item 2", "item 3"]

Add a slide with code

show.add code langauge: "ruby", source: <<-SOURCE
  def method
    awesome = true
  end
SOURCE

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Contributors

termnote's People

Contributors

doomhammer avatar halan avatar jessieay avatar krainboltgreene avatar mileszs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

termnote's Issues

Installing on OSX

I've been trying to install this on OSX and I keep running into issues. Below are my attempts and results. Do you have any suggestions? I'd love to use this project.

Attempt #1:

$ sudo gem install termnote

Building native extensions. This could take a while...
ERROR: Error installing termnote:
ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
creating Makefile

make
xcrun cc -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin11.0 -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin11.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -arch i386 -arch x86_64 -g -Os -pipe -fno-common -DENABLE_DTRACE -fno-common -pipe -fno-common -Wall -c posix-spawn.c
sh: /Developer/usr/bin/xcodebuild: No such file or directory
/Developer/usr/bin/xcodebuild fails with 32512 - Unknown error: 32512
make: *** [posix-spawn.o] Error 69

Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/posix-spawn-0.3.6 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/posix-spawn-0.3.6/ext/gem_make.out

Attempt #2:

I created a Gemfile to see if it was a dependency issue.

$ bundle install

Fetching gem metadata from http://rubygems.org/....
Using colored (1.2)
Installing posix-spawn (0.3.6) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
creating Makefile

make
xcrun cc -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin11.0 -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin11.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -arch i386 -arch x86_64 -g -Os -pipe -fno-common -DENABLE_DTRACE -fno-common -pipe -fno-common -Wall -c posix-spawn.c
sh: /Developer/usr/bin/xcodebuild: No such file or directory
/Developer/usr/bin/xcodebuild fails with 32512 - Unknown error: 32512
make: *** [posix-spawn.o] Error 69

Gem files will remain installed in /Users/james.tomasino/.bundler/tmp/71344/gems/posix-spawn-0.3.6 for inspection.
Results logged to /Users/james.tomasino/.bundler/tmp/71344/gems/posix-spawn-0.3.6/ext/gem_make.out
An error occurred while installing posix-spawn (0.3.6), and Bundler cannot continue.
Make sure that gem install posix-spawn -v '0.3.6' succeeds before bundling.

Terminal or REPL slides

Have a slide type that opens a repl, with a command key/value. Used for live coding of some sort.

Crash when pressing 'j' to go to next slide

I stuck the Ruby code from your README example into a file to try out. The first slide loads fine, but when I press 'j' to go to the next slide, it crashes.

Source:

require 'termnote'

include TermNote

show.add chapter title: "Hello, World"

show.add code language: "Ruby", source: <<-SOURCE
  puts "Hello, world!"
SOURCE

show.start

Backtrace:

/Users/Steveloveless/.rvm/gems/ruby-1.9.3-p286/gems/pygments.rb-0.3.2/lib/pygments/popen.rb:374:in `header_to_json': Traceback (most recent call last): (MentosError)
  File "/Users/Steveloveless/.rvm/gems/ruby-1.9.3-p286/gems/pygments.rb-0.3.2/lib/pygments/mentos.py", line 303, in start
    res = self.get_data(method, lexer, args, kwargs, text)
  File "/Users/Steveloveless/.rvm/gems/ruby-1.9.3-p286/gems/pygments.rb-0.3.2/lib/pygments/mentos.py", line 171, in get_data
    res = self.highlight_text(text, lexer, formatter_name, args, _convert_keys(opts))
  File "/Users/Steveloveless/.rvm/gems/ruby-1.9.3-p286/gems/pygments.rb-0.3.2/lib/pygments/mentos.py", line 122, in highlight_text
    lexer = self.return_lexer(lexer, args, kwargs, code)
  File "/Users/Steveloveless/.rvm/gems/ruby-1.9.3-p286/gems/pygments.rb-0.3.2/lib/pygments/mentos.py", line 79, in return_lexer
    return lexers.get_lexer_by_name(lexer, **inputs)
  File "/Users/Steveloveless/.rvm/gems/ruby-1.9.3-p286/gems/pygments.rb-0.3.2/vendor/pygments-main/pygments/lexers/__init__.py", line 80, in get_lexer_by_name
    raise ClassNotFound('no lexer for alias %r found' % _alias)
ClassNotFound: no lexer for alias 'Ruby' found
    from /Users/Steveloveless/.rvm/gems/ruby-1.9.3-p286/gems/pygments.rb-0.3.2/lib/pygments/popen.rb:257:in `handle_header_and_return'
    from /Users/Steveloveless/.rvm/gems/ruby-1.9.3-p286/gems/pygments.rb-0.3.2/lib/pygments/popen.rb:232:in `block in mentos'
    from /Users/Steveloveless/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/1.9.1/timeout.rb:68:in `timeout'
    from /Users/Steveloveless/.rvm/gems/ruby-1.9.3-p286/gems/pygments.rb-0.3.2/lib/pygments/popen.rb:203:in `mentos'
    from /Users/Steveloveless/.rvm/gems/ruby-1.9.3-p286/gems/pygments.rb-0.3.2/lib/pygments/popen.rb:186:in `highlight'
    from /Users/Steveloveless/.rvm/gems/ruby-1.9.3-p286/gems/termnote-1.1.0/lib/termnote/pane/code.rb:20:in `highlighted'
    from /Users/Steveloveless/.rvm/gems/ruby-1.9.3-p286/gems/termnote-1.1.0/lib/termnote/pane/code.rb:14:in `rows'
    from /Users/Steveloveless/.rvm/gems/ruby-1.9.3-p286/gems/termnote-1.1.0/lib/termnote/pane.rb:34:in `formated_rows'
    from /Users/Steveloveless/.rvm/gems/ruby-1.9.3-p286/gems/termnote-1.1.0/lib/termnote/pane.rb:26:in `render'
    from /Users/Steveloveless/.rvm/gems/ruby-1.9.3-p286/gems/termnote-1.1.0/lib/termnote/pane.rb:16:in `call'
    from /Users/Steveloveless/.rvm/gems/ruby-1.9.3-p286/gems/termnote-1.1.0/lib/termnote/show.rb:30:in `start'
    from show.rb:11:in `<main>'

Positioning problems based on terminal font size and font family

As pointed out by @mileszs in #5 there's a bit of a font-size/font-family issue that makes positioning a bit of a pain.

I see two solutions out of this:

  • Have a standard font size and make default positioning based on that with ways of changing the positioning algo.
  • Write a better algo that gives good positioning

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.