Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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:
- Correct faulty and chopped off HTML
- Syntax highlighter
- Convert URLs into links
- 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):
Below is a screen shot of how the XML is formatted:
I have some PHP code on the same post that is highlighted and formatted properly.
Comment | File | Size | Author |
---|---|---|---|
#3 | xml-syntax.txt | 283 bytes | BassistJimmyJam |
Comments
Comment #1
mattyoung CreditAttribution: mattyoung commentedplease 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,
:)
Comment #2
mattyoung CreditAttribution: mattyoung commentedSee the demo page, there is XML example:
http://zen.hddigitalworks.com/syntax-highlighter
Comment #3
BassistJimmyJam CreditAttribution: BassistJimmyJam commentedI 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.Comment #4
mattyoung CreditAttribution: mattyoung commentedI copy you input and add an example in http://zen.hddigitalworks.com/
the input is like this:
Comment #5
BassistJimmyJam CreditAttribution: BassistJimmyJam commentedIt 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.Comment #6
mattyoung CreditAttribution: mattyoung commented>the
Comment #7
BassistJimmyJam CreditAttribution: BassistJimmyJam commentedI am using D7 (see the version for this issue).
Comment #8
skipshot4 CreditAttribution: skipshot4 commentedHaving 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.
Comment #9
skipshot4 CreditAttribution: skipshot4 commentedThe 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"
Comment #10
mattyoung CreditAttribution: mattyoung commentedHm, 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?
Comment #11
fizk CreditAttribution: fizk commentedI was able to reproduce this, and #9 resolves the issue.
This should be added to the documentation.