Forum
A text editor plugin that works for implementing code?
Iv tried a few that work with Perch, i'm currently using CKEditor.
None of them work well when inserting code it's really frustrating.
And even if you do manage to get all the code blocks in without it looking a mess, if you go back into the editor it all gets messed up again.
Anyone had any luck with a solid text editor?
Cheers
For now i'm embedding individual gists from Github, seems alright for now. Anyone have any better ideas let me know.
Can you give a more specific description of what you're trying to achieve and what's happening?
When I try to put code into the wysiwyg editor, it doesn't display properly in the front end. And in some cases when I go back into the backend parts of it are missing. I'v tried all the editors with various code plugins for the CKEditor but to no avail.
Some PHP code just won't go in. Can't get it to insert into this forum post neither.
How are you entering the code?
with
And what result do you get?
I get a load of jumbled code like
It's the PHP code, it's not staying within the <code></code>
That looks a lot like CKEditor's doing to me.
That was with tinymce, I'm using tinymce because it's the only one that I'm able to use GitHubs script embed codes on.
You are going to have trouble if you mix a WYSIWYG editor (that is expecting HTML) and code you want to render.
I'd be creating a Blocks template with an option to add a "code block", and not put an editor at all on that block.
If you must do it inline you'd be better off using Markdown or Textile as you can insert code sections into both and as long as you have html set to false on those areas Perch won't touch it either.
So iv just looked at Blocks in perch and it looks great.
How would a 'code block' be configured to output code that the user can read just like the <code></code> tags in the WYSIWYG editors?
I'm loving the blocks!
The <code></code> tags still don't contain my PHP code, but I'm not sure that's a perch thing?? I think it's just the PHP.
Example of my php I wanted to insert into <code> tags is here:
https://kieranhunter.co.uk/next-previous-wordpress-post-links/ (the first block of PHP)
I tried the same code with the <?php ?> before and after as well but no luck.
I don't understand this:
What result are you looking for?
I just double checked it again, and now it seems to be working, with the Perch Blocks solution. Really nice idea that is. Cheers.