I recently switched from geshifilter to syntaxhighlighter and it's working great to highlight PHP code. However, when I try to use it to highlight XML it ends up all on one line. I am using the Full HTML text format with the filters in the following order:

  1. Correct faulty and chopped off HTML
  2. Syntax highlighter
  3. Convert URLs into links
  4. Convert line breaks into HTML

Below is a screen shot of how the code is formatted (Note that I am not using a WYSIWYG editor):
XML Code

Below is a screen shot of how the XML is formatted:
XML Highlighting

I have some PHP code on the same post that is highlighted and formatted properly.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mattyoung’s picture

please attache a file of your XML listing text, you have it already, so I'm not going to type that again...
I'm not going type that....(x)

See, you only show picture image of your xml but no raw text formated whatever you want to show.....

...you or whoever look at the picture above....translate that into utf8 encoded xml text file,

:)

mattyoung’s picture

See the demo page, there is XML example:

http://zen.hddigitalworks.com/syntax-highlighter

BassistJimmyJam’s picture

FileSize
283 bytes

I have looked at the example but it has not helped. I have tried both the {syntaxhighlighter brush: xml;} and <pre class="brush: xml;"> syntaxes and they both result in the XML all on one line. I have attached a text file with a snippet from a sample node.

mattyoung’s picture

I copy you input and add an example in http://zen.hddigitalworks.com/

the input is like this:


{syntaxhighlighter title="XML" class="brush: xml"}


<multi_part_field>
  <part id="area_code">717</part>
  <part id="prefix">609</part>
  <part id="line_number">0029</part>
  <part id="extension">123</part>
  <part id="country_code">1</part>
  <part id="type">United States</part>
</multi_part_field>


{/syntaxhighlighter}


BassistJimmyJam’s picture

Title: XML displays on a single line » XML displays on a single line using pre syntax
Version: 7.x-1.1 » 7.x-1.x-dev

It looks like this only works in the dev release, not the stable 1.1 that is available. It also only works if you use the {syntaxhighlighter brush: xml;} syntax, the <pre class="brush: xml;"> syntax still results in a single line.

mattyoung’s picture

>the

 syntax still results in a single line.

<pre> only works in D7, D6 must use the {syntaxhighlighter} syntax. This will never change. Only use <pre> in D7 version and change your content accordingly to the new <pre> format for complete WYSIWYG editor friendliness..

BassistJimmyJam’s picture

I am using D7 (see the version for this issue).

skipshot4’s picture

Priority: Normal » Major

Having the same problem. Running D7 and XML syntax is being put all on one line.

Happening with both the stable release and the dev release.

Anyone have recommendations on how to fix this or get around it? It's a big problem for us.

skipshot4’s picture

The problem goes away if you go into
Administration › Configuration › Content authoring › Text Formats

Select the text format you're using and having problems with.

Uncheck "Correct faulty and chopped off HTML"

mattyoung’s picture

Hm, that interesting. I put <pre> tag around each SH code block. All filter should leave everything inside alone and not muck with it.

How exactly does "Correct faulty and chopped off HTML" filter work? What does it do?

Again, no filter should touch stuff inside <pre> tag, yes?

fizk’s picture

Status: Active » Closed (fixed)

I was able to reproduce this, and #9 resolves the issue.

This should be added to the documentation.