Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
Redmine Markdown Formatter
==========================

This is a redmine plugin for supporting Markdown as a wiki format.

What is redmine?
----------------

Redmine is a flexible project management web application.
See [the official site](http://www.redmine.org) for more details.


What is Markdown?
-----------------

Markdown is a text-to-HTML conversion tool for web writers. Markdown allows
you to write using an easy-to-read, easy-to-write plain text format, then
convert it to structurally valid XHTML (or HTML).

See [the article on John Gruber's blog](http://daringfireball.net/projects/markdown/)
for more details.


Plugin installation
-------------------

### Prerequisites

* Redmine and its prerequisites
* [rdiscount](http://tomayko.com/writings/ruby-markdown-libraries-real-cheap-for-you-two-for-price-of-one) gem

### Installation

1. Copy the plugin directory into the vendor/plugins directory
2. Start Redmine

Installed plugins are listed on 'Admin -> Information' screen.

Don't forget to change "Text formatting" option under
Administration -> Settings -> General tab.

### Credits
* [Yuki Sonoda](http://github.com/yugui) did the real work by creating the
redmine_rd_formatter
* Jean-Philippe Lang for making the change to Redmine (based on Yuki's patch) to
allow pluggable formatters

### Future Plans
* make the blockquote and unblockquote work for list items to indent
and un-indent. Current behavior is kind of confusing.
20 changes: 13 additions & 7 deletions app/helpers/redmine_markdown_formatter/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,16 @@ module Helper
unloadable

def wikitoolbar_for(field_id)

heads_for_wiki_formatter

url = Redmine::Utils.relative_url_root +
Engines::RailsExtensions::AssetHelpers.plugin_asset_path('redmine_markdown_formatter', 'help', 'markdown_syntax.html')

help_link = l(:setting_text_formatting) + ': ' +
link_to(l(:label_help), url,
:onclick => "window.open(\"#{url}\", \"\", \"resizable=yes, location=no, width=300, height=640, menubar=no, status=no, scrollbars=yes\"); return false;")

javascript_include_tag('jstoolbar/jstoolbar') +
javascript_include_tag('markdown', :plugin => 'redmine_markdown_formatter') +
# javascript_include_tag("lang/markdown-#{current_language}", :plugin => 'redmine_markdown_formatter') +
javascript_include_tag("jstoolbar/lang/jstoolbar-#{current_language}") +
javascript_tag("var toolbar = new jsToolBar($('#{field_id}')); toolbar.setHelpLink('#{help_link}'); toolbar.draw();")
javascript_tag("var wikiToolbar = new jsToolBar($('#{field_id}')); wikiToolbar.setHelpLink('#{escape_javascript help_link}'); wikiToolbar.draw();")
end


Expand All @@ -24,7 +21,16 @@ def initial_page_content(page)
end

def heads_for_wiki_formatter
stylesheet_link_tag('jstoolbar')
unless @heads_for_wiki_formatter_included
content_for :header_tags do
javascript_include_tag('jstoolbar/jstoolbar') +
javascript_include_tag('markdown', :plugin => 'redmine_markdown_formatter') +
# javascript_include_tag("lang/markdown-#{current_language}", :plugin => 'redmine_markdown_formatter') +
javascript_include_tag("jstoolbar/lang/jstoolbar-#{current_language.to_s.downcase}") +
stylesheet_link_tag('jstoolbar')
end
@heads_for_wiki_formatter_included = true
end
end
end
end