<commit_before>= Bespin on Rails

Bespin on Rails is a simple Ruby on Rails plugin that allows you to embed the Mozilla
Bespin code editor component in your Rails views using simple helper tags.

Bespin is a Mozilla Labs experiment on how to build an extensible Web code
editor using HTML 5 technology.

Bespin Project home page: http://labs.mozilla.com/projects/bespin
Bespin Live system: https://bespin.mozilla.com

This plugin comes bundled with Bespin (head version 2009/04/27). To learn more
about Bespin have a look at their Labs site at http://labs.mozilla.com/projects/bespin. 
Please report any issue with the editor on their issue tracker.

There is also an unofficial Bespin mirror on GitHub at http://github.com/bespin/bespin.

To report issues related to the plugin please use the issue tracker on
GitHub at http://github.com/provideal/bespin-on-rails/issues.

If you have any comments on the plugin please contact me (René) by email 
(info AT provideal DOT net) or on Twitter (@renspr).

== Requirements

You need at least Rails 2.3 for this plugin. To make the bundled resources
available in your applications public folder the plugin will create a symlink
from your applications public folder to the plugins public folder. This is
currently done using the 'ln' unix command. As a result the plugin won't
work on Windows.

To work around this you can manually copy all files from vendor/plugins/bespin-on-rails/public
to public/_plugins/bespin-on-rails.

You need a browser that is able to work with Mozilla Bespin. Safari 4 (beta) and 
Mozilla Firefox 3.0.9 are fine.

== Installation

Download the plugin from http://github.com/provideal/bespin-on-rails and install
it in vendor/plugins/bespin-on-rails.

We will provide a gem based installation in the next release.

== Usage

In your application layout (typically somewhere below <%= javascript_include_tag(:defaults) %>)

  ...
  <head>
    ...
    <%= bespin_include_tag %>
  </head>
  ...

In your views (examples)

  <% form_tag ... do %>
    ...
    <%= bespin_editor_tag 'snippet', '<div>some html snippet</div>' %>
    ...
  <% end %>

  <% form_for @code_snippet do |f| %>
    ...
    <%= bespin_editor_tag 'code_snippet[snippet]', '<div>some html snippet</div>' %>
    ...
  <% end %>

== Configuration

You may pass an optional hash of options as a third parameter to +bespin_editor_tag+ as follows:

* <tt>:editor_style</tt> - CSS style attributes as a string for styling the editor. The editor
  is just a <div>.

Example:

  <% form_for @code_snippet do |f| %>
    ...
    <%= bespin_editor_tag 'code_snippet[snippet]', '<div>some html snippet</div>', :editor_style => 'height: 600px' %>
    ...
  <% end %>

This will set the height of the editor to 600px.

* <tt>:language</tt> - A string telling Bespin which syntax highlighter to use. This default to 'html'.<commit_msg>improved readme<commit_after>= Bespin on Rails

Bespin on Rails is a simple Ruby on Rails plugin that allows you to embed the Mozilla
Bespin code editor component in your Rails views using simple helper tags.

Bespin is a Mozilla Labs experiment on how to build an extensible Web code
editor using HTML 5 technology.

Bespin Project home page: http://labs.mozilla.com/projects/bespin
Bespin Live system: https://bespin.mozilla.com

This plugin comes bundled with Bespin (head version 2009/04/27). To learn more
about Bespin have a look at their Labs site at http://labs.mozilla.com/projects/bespin. 
Please report any issue with the editor on their issue tracker.

There is also an unofficial Bespin mirror on GitHub at http://github.com/bespin/bespin.

To report issues related to the plugin please use the issue tracker on
GitHub at http://github.com/provideal/bespin-on-rails/issues.

If you have any comments on the plugin please contact me (René) by email 
(info AT provideal DOT net) or on Twitter (@renspr).

== Requirements

You need at least Rails 2.3 for this plugin. To make the bundled resources
available in your applications public folder the plugin will create a symlink
from your applications public folder to the plugins public folder. This is
currently done using the 'ln' unix command. As a result the plugin won't
work on Windows.

To work around this you can manually copy all files from vendor/plugins/bespin-on-rails/public
to public/_plugins/bespin-on-rails.

You need a browser that is able to work with Mozilla Bespin. Safari 4 (beta) and 
Mozilla Firefox 3.0.9 are fine.

== Installation

Download the plugin from http://github.com/provideal/bespin-on-rails and install
it in vendor/plugins/bespin-on-rails.

We will provide a gem based installation in the next release.

== Usage

In your application layout (typically somewhere below <%= javascript_include_tag(:defaults) %>)

  ...
  <head>
    ...
    <%= bespin_include_tag %>
  </head>
  ...

In your views (examples)

  <% form_tag ... do %>
    ...
    <%= bespin_editor_tag 'snippet', '<div>some html snippet</div>' %>
    ...
  <% end %>

  <% form_for @code_snippet do |f| %>
    ...
    <%= bespin_editor_tag 'code_snippet[snippet]', '<div>some html snippet</div>' %>
    ...
  <% end %>

== Configuration

You may pass an optional hash of options as a third parameter to +bespin_editor_tag+ as follows:

* <tt>:editor_style</tt> - CSS style attributes as a string for styling the editor. The editor
  is just a <div>.

Example:

  <% form_for @code_snippet do |f| %>
    ...
    <%= bespin_editor_tag 'code_snippet[snippet]', '<div>some html snippet</div>', :editor_style => 'height: 600px' %>
    ...
  <% end %>

This will set the height of the editor to 600px.

* <tt>:language</tt> - A string telling Bespin which syntax highlighter to use. This defaults to 'html'.
{'fraction_non_alphanumeric': 0.09518810148731409, 'fraction_numerical': 0.007349081364829396, 'mean_word_length': 3.6547231270358305, 'pattern_counts': {'":': 0, '<': 51, '<?xml version=': 0, '>': 53, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2424031', 'n_tokens_mistral': 1819, 'n_tokens_neox': 1649, 'n_words': 726}