2

I have been looking a lot for it but haven't found anithing...

(i want just some editor -i know the same it's hard to get done- like the one i'm using now, where i can share my code in my blog)(My own CMS)

So,

I guess some went through this one before, can i embed code using tinyMce?

any conclusion?

thanks a lot

PD: i've seen that stackoverflow uses a fork from WMD wich is not online but in github, anyone has an example of use? (only .js files there)

PD2: thanks a lot, again!

EDIT

Well, after some replies got to prettyprint -> here

wich only need to be loaded on $(document).ready() And will prettify (lol) any of those:

<pre class="prettyprint"> code here  </pre>

So i'm trying to add this format to tinimce with:

style_formats : [
                {title : 'Bold text', inline : 'b'},
                {title : 'Blue text', inline : 'span', styles : {color : '#006'}},
                {title : 'Blue header', block : 'h1', styles : {color : '#006'}},
          -->   {title : 'Codigo fuente', inline : 'pre', classes : 'prettyprint'},    
                {title : 'Example 2', inline : 'span', classes : 'example2'},
                {title : 'Table styles'},
                {title : 'Table row 1', selector : 'tr', classes : 'tablerow1'}
        ],

But if i use it turns into a <p> on $_POST, why?

Edit two

this one works: {title : 'Codigo fuente', block : 'pre', classes : 'prettyprint'},

The problem it's that i get

<pre ..>line 1</pre>
<pre ..>line 2</pre> 

..

and i would like to apply:

<pre..>
line1 
line2
</pre>

how can i solve this? if i change block by inline, simply the style it's not even applied :?

Gracias!

3
  • 1
    A good place to start is asking a question? Commented Mar 31, 2011 at 14:15
  • I thought i was already, but i edited a bit. Thanks! Commented Mar 31, 2011 at 14:24
  • Do you want to embed code to show your users, e.g. PHP code samples in a tutorial, or embed code to run on the blog post? Commented Mar 31, 2011 at 14:26

2 Answers 2

1

EDIT: sorry for the improper placement, Still kind of new here. As far as I know you can past code straight into tinymce and it won't interpret it. When it stores it it should add all the necessary escapes so when it's displayed on your blog or whatever it will look liek code. What it won't do it automatically format it in a nice read friendly fashion and add coloring and such. I imagine there must be a plugin or some alternative for that... bbiam :P

EDIT2: this -> http://www.maclovin.de/syntaxhl-editor/ seems like a good option.

download - > https://github.com/RichGuk/syntaxhl

EDIT3: also this might be nice as well -> http://code.google.com/p/google-code-prettify/ Makes the code all nice and pretty, hence the name.

ORIGINAL:I'm a bit confused, do you want code you put into tiny MCE to be active code or do you want it to be code samples?

<A href="www.google.com">google</a>

or http://www.google.com

Sign up to request clarification or add additional context in comments.

3 Comments

This is a good question, and belongs in a comment, not an answer :)
i want to be able to do what you just did in your answer, showing us html code (if posible to also style PHP and javascript)
thanks mate! So it looks that by <pre class="prettyprint">...</pre> will be showing code using prettify. If that is true, i only need to configure tinymce to apply that tag&class rgith? i'll theck RichGuk in the meanwhile.. :P
1

Maybe, you can use this one: SyntaxHighlighter or some other syntax highlighter...

And use the forum/website of tinymce, because your question is related to tinymce. Read the manual. Look for plugins and the implementation of them.

Hint: Search first in the Resources of the developers or use google... Google Results

3 Comments

you have not read completelly my question (i did search a lot), i want to ask it here, i don't think it's not the plce :). Thanks for your answer thought, i'll check stxhlighter ;)
My opinion is, when i use a tool, then i look first in the developer resource. Tinymce is highly configurable tool.
here two lists: webdesignbooth.com/… and webresourcesdepot.com/… but you can look at Geshi. I use this one...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.