문제

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>
도움이 되었습니까?

해결책

This might be what you're looking for:

http://ckeditor.com/addon/codemirror

다른 팁

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.

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.

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top