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 : … -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 =[:data]).to_html
    render :layout => false

and then in my parse_textile view:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

<html xmlns="" xml:lang="en" lang="en">
  <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
  <%= stylesheet_link_tag 'styles_for_the_parsed_textile' %>
<%= @textile %>

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