Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SyntaxHighlighter margin bug with bootstrap?

I have this code.

<pre class="brush: xml">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;Test xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot;&gt;
    &lt;ABC&gt;
      &lt;A&gt;B&lt;/A&gt;
    &lt;/ABC&gt;
&lt;/Test&gt;</pre>

And this javascript.

<script type="text/javascript">SyntaxHighlighter.all();</script>

Before that I loaded:

  • XRegExp.js
  • shCore.js
  • shBrushXml.js

And the css:

  • shCoreRDark.css
  • shThemeRDark.css

But it looks like: Bug example

The problem is that the first line is between line 1 and 2. The margin issnt correct or something else!? I dont know. With FireBug I cant find the problem :(

And by the way... Is it possible to disable/hide the "?" button on the top right corner?

Fiddle example (bad parsing!?): http://jsfiddle.net/Zrm2G/

like image 219
PatrickB Avatar asked Jun 20 '26 04:06

PatrickB


1 Answers

I believe the issue has to do with the SyntaxHighlighter using class="container" which has a name collision with BootStrap.

In particular, bootstrap.css adds the following, which is putting the margin in before our displayable content:

.container:before, .container:after {
    display: table;
    content: "";
    line-height: 0;
}

I resolved this by overriding this css in my sites main css file when the container class is used within the SyntaxHighlighter table:

.syntaxhighlighter table .container:before {
    display: none !important;
}
like image 185
Derek Eatough Avatar answered Jun 21 '26 16:06

Derek Eatough



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!