4

I'm using the ckeditor gem and when I use the paste as plain text dialog it encapsulates the text in quotes as well as < p> tags and < br> tags. Is there any way I can tell ckeditor not to use any markup whatsoever when using that option.

What I am trying to accomplish is to have snippets of code within an article. Those snippets are processed using the markdown gem as well as pigments.rb. The following code is what I'm trying to accomplish

```ruby 
  puts "hello world"

  class Hello 
  end
```

and this is what I'm getting

<p>
```ruby<br />
    &nbsp; puts &quot;hello world&quot;
&nbsp; class hello<br />
&nbsp; end<br /></p>
4

4 に答える 4

1

I really don't know if the ckeditor has that option.

If your problem is show the information like WYSIWYG in a web with RoR maybe you have to set in the view that the information is html safe (This is for security reasons and is set by default). If you don't do that you will see with the html tags.

You have many ways to do the html safe:

Here is a discussion about which one use: raw vs. html_safe vs. h to unescape html

Hope that solve your problem.

于 2012-07-22T19:25:55.710 に答える
1

This might be what you're looking for:

http://ckeditor.com/addon/codemirror

于 2013-04-11T21:15:09.713 に答える
0

Codemirror might be your best bet for this. Its like CKeditor but for code.

http://codemirror.net/

You could even write your own mode for it, which if I understand what your trying to do might end up being required.

于 2012-07-22T20:54:23.717 に答える
0

Have not found anything better than going with Markdown. Just like it is done here on SO

于 2012-08-13T13:09:03.593 に答える