Permalink
Browse files

Used regular markdown syntax for code blocks for YARD to format it pr…

…operly
  • Loading branch information...
Mon-Ouie committed Mar 27, 2013
1 parent 44a4105 commit 110220c5269b9e8fd7a1933c8f70e988484a2ddc
Showing with 33 additions and 39 deletions.
  1. +33 −39 README.md
View
@@ -15,53 +15,49 @@ Usage
If you don't need anything fancy, it can work like Ruby's built-in `Readline.readline`:
```ruby
result = Coolline.readline
```
result = Coolline.readline
But, of course you want something fancy, otherwise you'd be using `readline`!
Here's how to create a simple REPL with live syntax highlighting and tab completion:
```ruby
require 'coolline'
require 'coderay'
require 'pp'
require 'coolline'
require 'coderay'
require 'pp'
cool = Coolline.new do |c|
cool = Coolline.new do |c|
# Before the line is displayed, it gets passed through this proc,
# which performs syntax highlighting.
c.transform_proc = proc do
CodeRay.scan(c.line, :ruby).term
end
# Before the line is displayed, it gets passed through this proc,
# which performs syntax highlighting.
c.transform_proc = proc do
CodeRay.scan(c.line, :ruby).term
end
# Add tab completion for constants (and classes)
c.completion_proc = proc do
word = c.completed_word
Object.constants.map(&:to_s).select { |w| w.start_with? word }
end
# Add tab completion for constants (and classes)
c.completion_proc = proc do
word = c.completed_word
Object.constants.map(&:to_s).select { |w| w.start_with? word }
end
# Alt-R should reverse the line, because we like to look at our code in the mirror
c.bind "\er" do |cool|
cool.replace_line cool.line.reverse
end
# Alt-R should reverse the line, because we like to look at our code in the mirror
c.bind "\er" do |cool|
cool.replace_line cool.line.reverse
end
end
end
loop do
# READ
line = cool.readline
loop do
# READ
line = cool.readline
# EVAL
obj = eval(line)
# EVAL
obj = eval(line)
# PRINT
print "=> "
pp obj
# PRINT
print "=> "
pp obj
# LOOP
end
```
# LOOP
end
Configuration
=============
@@ -70,11 +66,9 @@ Coolline automatically loads a config file before starting, which allows adding
new key bindings to it. The file is just a chunk of arbitrary ruby code located
at ``$XDG_CONFIG_HOME/coolline/coolline.rb``.
```ruby
Coolline.bind "\C-z" do |cool|
puts "Testing key binding with #{cool}!"
end
```
Coolline.bind "\C-z" do |cool|
puts "Testing key binding with #{cool}!"
end
Installation
============

3 comments on commit 110220c

@epitron

This comment has been minimized.

Show comment
Hide comment
@epitron

epitron Mar 27, 2013

Contributor

YARD doesn't support that?

Doh! Githubbbb!!

Contributor

epitron replied Mar 27, 2013

YARD doesn't support that?

Doh! Githubbbb!!

@netzpirat

This comment has been minimized.

Show comment
Hide comment
@netzpirat

netzpirat Mar 27, 2013

@epitron YARD supports multiple markdown provider and e.g. redcarpet does support Github flavored markdown. Just put

--markup-provider redcarpet

in your .yardopts and it also work on RubyDoc.info. We do this with Guard, see http://rubydoc.info/gems/guard/frames

netzpirat replied Mar 27, 2013

@epitron YARD supports multiple markdown provider and e.g. redcarpet does support Github flavored markdown. Just put

--markup-provider redcarpet

in your .yardopts and it also work on RubyDoc.info. We do this with Guard, see http://rubydoc.info/gems/guard/frames

@epitron

This comment has been minimized.

Show comment
Hide comment
@epitron

epitron Mar 27, 2013

Contributor

Nice! How bout it, Mon-Ouie?

Contributor

epitron replied Mar 27, 2013

Nice! How bout it, Mon-Ouie?

Please sign in to comment.