<commit_before>= MarkItUp

MarkItUp is Rails plugin that helps you turn any textarea into a markup editor. It is based on excellent {markItUp jQuery plugin}[http://markitup.jaysalvat.com/].

== Installation

  script/plugin install git://github.com/cingel/mark_it_up.git
  
During install all assets will be copied to [Rails.root]/public/mark_it_up
  
You can optionally generate MarkItUpController to be able to use default preview parser.

  script/generate miu_controller

Also you will have to download jQuery[http://jquery.com/] and make it {play nicely with Prototype}[http://docs.jquery.com/Using_jQuery_with_Other_Libraries] if you are using prototype 
  
== Examples

=== The most simple usage with preset defaults

  <html>
  <head>
    <%= javascript_include_tag "path/to/jquery" %>
    <%= mark_it_up '#miu_test' %>
  </head>
  <body>
    <% form_tag do %>
      <%= text_area_tag "miu_test" %>
    <% end %>
  </body>
  </html>
  
=== Define custom buttons
  
  <html>
  <head>
  <%= javascript_include_tag "jquery" %>
  <% 
    MarkItUp.buttons = [
      { :name => 'Bold', :icon => 'bold', :key => 'B', :openWith => '(!(<strong>|!|<b>)!)', :closeWith => '(!(</strong>|!|</b>)!)' },
      { :name => 'Italic', :icon => 'italic', :key => 'I', :openWith => '(!(<em>|!|<i>)!)', :closeWith => '(!(<em>|!|<i>)!)' },
      { :name => 'Stroke through', :icon => 'stroke', :key => 'S', :openWith => '<del>', :closeWith => '</del>' }
    ]
  %>
  <%= mark_it_up '#miu_test' %>
  </head>
  <body>
  <% form_tag do %>
    <%= text_area_tag "miu_test" %>
  <% end %>
  </body>
  </html>
  
=== Insert, Replace, Delete buttons

Here is the syntax

  MarkItUp.replace_button(position, new_button)  # replaces button at exact position
  MarkItUp.insert_button(new_button) # inserts button at the end
  MarkItUp.insert_button(position, new_button) # inserts button at exact position (buttons after position are moved up)
  MarkItUp.delete_button(position) # deletes button at exact position
  MarkItUp.delete_button(name) # deletes button which matches name

and here is example

  <html>
  <head>
  <%= javascript_include_tag "jquery" %>
  <% 
    MarkItUp.buttons = MarkItUp.default_buttons
    MarkItUp.replace_button(15, { :name => 'Image', :icon => "image", :key => 'P', :replaceWith => '<img src="/path" alt="" />' })
    MarkItUp.insert_button(16, { :name => 'Some button', :icon => 'some_icon', :key => 'X', :replaceWith => 'somtehing' }) # insert new button at specific position 
    MarkItUp.insert_button(17, { :separator => '---------------' })
    MarkItUp.insert_button({ :name => 'Some other button', :icon => 'some_other_icon', :key => 'Y', :replaceWith => 'something else' })
    MarkItUp.delete_button(3)
    MarkItUp.delete_button("Bold")
  %>
  <%= mark_it_up '#miu_test' %>
  </head>
  <body>
  <% form_tag do %>
    <%= text_area_tag "miu_test" %>
  <% end %><commit_msg>readme updated with link on examples<commit_after>= MarkItUp

MarkItUp is Rails plugin that helps you turn any textarea into a markup editor. It is based on excellent {markItUp jQuery plugin}[http://markitup.jaysalvat.com/].

== Installation

  script/plugin install git://github.com/cingel/mark_it_up.git
  
During install all assets will be copied to [Rails.root]/public/mark_it_up
  
You can optionally generate MarkItUpController to be able to use default preview parser.

  script/generate miu_controller

Also you will have to download jQuery[http://jquery.com] and make it {play nicely with Prototype}[http://docs.jquery.com/Using_jQuery_with_Other_Libraries] if you are using prototype 
  
== Examples

You can see all examples here[http://markitup.cingel.hr]

=== The most simple usage with preset defaults

  <html>
  <head>
    <%= javascript_include_tag "path/to/jquery" %>
    <%= mark_it_up '#miu_test' %>
  </head>
  <body>
    <% form_tag do %>
      <%= text_area_tag "miu_test" %>
    <% end %>
  </body>
  </html>
  
=== Define custom buttons
  
  <html>
  <head>
  <%= javascript_include_tag "jquery" %>
  <% 
    MarkItUp.buttons = [
      { :name => 'Bold', :icon => 'bold', :key => 'B', :openWith => '(!(<strong>|!|<b>)!)', :closeWith => '(!(</strong>|!|</b>)!)' },
      { :name => 'Italic', :icon => 'italic', :key => 'I', :openWith => '(!(<em>|!|<i>)!)', :closeWith => '(!(<em>|!|<i>)!)' },
      { :name => 'Stroke through', :icon => 'stroke', :key => 'S', :openWith => '<del>', :closeWith => '</del>' }
    ]
  %>
  <%= mark_it_up '#miu_test' %>
  </head>
  <body>
  <% form_tag do %>
    <%= text_area_tag "miu_test" %>
  <% end %>
  </body>
  </html>
  
=== Insert, Replace, Delete buttons

Here is the syntax

  MarkItUp.replace_button(position, new_button)  # replaces button at exact position
  MarkItUp.insert_button(new_button) # inserts button at the end
  MarkItUp.insert_button(position, new_button) # inserts button at exact position (buttons after position are moved up)
  MarkItUp.delete_button(position) # deletes button at exact position
  MarkItUp.delete_button(name) # deletes button which matches name

and here is example

  <html>
  <head>
  <%= javascript_include_tag "jquery" %>
  <% 
    MarkItUp.buttons = MarkItUp.default_buttons
    MarkItUp.replace_button(14, { :name => 'Image', :icon => "image", :key => 'P', :replaceWith => '<img src="/path" alt="" />' })
    MarkItUp.insert_button(16, { :name => 'Some button', :icon => 'some_icon', :key => 'X', :replaceWith => 'something' }) # insert new button at specific position 
    MarkItUp.insert_button(17, { :separator => '---------------' })
    MarkItUp.insert_button({ :name => 'Some other button', :icon => 'some_other_icon', :key => 'Y', :replaceWith => 'something else' }) # insert new button to the end
    MarkItUp.delete_button(3)
    MarkItUp.delete_button("Bold")
  %>
  <%= mark_it_up '#miu_test' %>
  </head>
  <body>
  <% form_tag do %>
    <%= text_area_tag "miu_test" %>
  <% end %>
{'fraction_non_alphanumeric': 0.17698964873578824, 'fraction_numerical': 0.0023756999830307143, 'mean_word_length': 3.8035859820700897, 'pattern_counts': {'":': 0, '<': 91, '<?xml version=': 0, '>': 147, 'https://': 0, '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': '853650', 'n_tokens_mistral': 2126, 'n_tokens_neox': 1994, 'n_words': 521}