Page 1 of 1

Inserting XML Code

Posted: Wed Jan 07, 2015 7:39 pm
by meritweb
We have a blog where some of our Software Developers post code best practices, etc...

I am trying to insert some XML Code Snippets into my article using the GeShi markup up - but nothing is showing up in my article. When I put the code in the Article's HTML Source Editor, and then switch over to the WYSIWYG Editor - nothing is there.

Any advice on what I'm doing wrong? How do I display Markup XML Code?

Re: Inserting XML Code

Posted: Wed Jan 07, 2015 7:54 pm
by yellowled
meritweb wrote:When I put the code in the Article's HTML Source Editor, and then switch over to the WYSIWYG Editor - nothing is there.
Wild guess – do you “mask” the angle brackets in your XML code? Because those are special characters in HTML (basically meaning: HTML uses angle brackets as well), so you'd probably have to enter them as HTML entities.

So not

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
but

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
YL

Re: Inserting XML Code

Posted: Fri Jan 09, 2015 12:12 pm
by garvinhicking
Hi!

Most probably, straight XML markup and WYSIWYG editor don't mix well.

If you enter it in sourcecode mode, when sewitching back the WYSIWYG editor will "Kill" that invalid markup. If you enter it in the WYSIWYG mode, then Geshi will not properly pick it up because it contains HTML special characters.

Ideally you should turn off the WYSIWYG editor if you plan to post code snippets with a syntax highlighter. Or you should not use syntax highlighters, and highlight/markup the text on your own in the WYSWIYG editor...

Re: Inserting XML Code

Posted: Sat Jan 10, 2015 4:16 am
by meritweb
Garvin, thank you so much. That did it!

Re: Inserting XML Code

Posted: Sat Jan 10, 2015 10:17 am
by Timbalu
garvinhicking wrote:Ideally you should turn off the WYSIWYG editor if you plan to post code snippets with a syntax highlighter. Or you should not use syntax highlighters, and highlight/markup the text on your own in the WYSWIYG editor...
Or use the Serendipity CKEDITOR event plugin seulement, which comes by default with an excellent, extra added codesnippet/highlighter plugin to avoid the CKEDITOR ACF Filter removing snips like this, changing the view mode or saving the entry. It has a XML highlight language too.

Re: Inserting XML Code

Posted: Sat Jan 10, 2015 12:52 pm
by garvinhicking
Thanks Timbalu for that addition, wasn't aware of that. Good to know!