Topic: markitup problems

I'm trying to use markitup to help users submit formatted textile markup and I'm having problems applying css to the preview window.
My previewTemplatePath which is '/javascripts/markitup/templates/preview.html' is not being read for some reason.

Has anyone else run into this?

Re: markitup problems

I've a problem too, the preview window is empty (ActionController::InvalidAuthenticityToken). I don't specify a authenticity token. How I know it ?

Edit : for me, In the controller which contains le preview method, I put :
  skip_before_filter :verify_authenticity_token

In the routes.rb, i put  :
  map.resources :pages, :collection => {:preview => :get}

Maybe there are a solution to your problem here :
http://markmcb.com/2008/11/08/install-m … -on-rails/

Sorry for my bad English...

Last edited by riven (2009-01-09 06:48:21)

Re: markitup problems

It's wonderful for me !

You must put in your set.js file (javascripts/markitup/sets/default/set.js)

previewParserPath: '/pages/preview', // path to your Textile parser (for me /:controller/:action)

You create a view to render a page with his content (this view or layout must contain a tag link for the css).

Re: markitup problems

Thank you so much riven. I thought one of the js functions was supposed to take my parsed textile (now html) and put it in preview.html.
It just didn't dawn on me to pass an entire view back.
So, for anyone else this is what I did.

previewParserPath: '/controller/parse_textile'

Then in my controller:

def parse_textile
    @textile = RedCloth.new(params[:data]).to_html
    render :layout => false
end

and then in my parse_textile view:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
  <%= stylesheet_link_tag 'styles_for_the_parsed_textile' %>
</head>
<body>
<%= @textile %>
</body>
</html>


I just made it a complete html page since I didn't want the preview to be in my site's layout.