Is there any way to remove the line numbers of SyntaxHighlighter?
Thanks!
Is there any way to remove the line numbers of SyntaxHighlighter?
Thanks!
You can set the SyntaxHighliter's gutter configuration to false. This will remove the line number from your code.
<pre class="brush: java; gutter: false;"></pre>
Hit the "view plain" link?
Taking a look at the SyntaxHighlighter demo you will see it has buttons in the top right corner which you can click to either copy the code to your clipboard, see the actual source code (removing markup) and or print it.
Are you asking us how to remove the actual feature that adds the line numbers while still keeping the rest of the functionality in place? Are you asking us to do this for you?
In response to comment:
If you want to keep the functionality in place, and just remove the line numbers you will need to download a copy of the javascript file for yourself and remove the features you don't want. the SyntaxHighlighter download page allows you to download your very own version of the highlighter, it also tells you that is is licensed under the LGPL 3, which means you have to follow those rules when you make and use your modifications.
If you want, you may come back and ask individual Javascript questions, if you get stuck in a particular spot, but we are not TopCoder nor will we re-write code for you.
If you don't want to edit your existing markup, you can turn it off globally by editing the shCore.js
file:
var sh = {
defaults : {
...
...
...
/** Enables or disables gutter. */
'gutter' : false,
...
...
...
},
...
...
...
}
You can set the default of 'gutter' => 0 in SyntaxHighlighter Evolved version 3.2.1 by editing the file syntaxhighlighter.php. Look for this in the file:
// Create array of default settings (you can use the filter to modify these)
$this->defaultsettings = (array) apply_filters(
'syntaxhighlighter_defaultsettings', array(
'theme' => 'default',
'loadallbrushes' => 0,
'shversion' => 3,
'title' => '',
'autolinks' => 1,
'classname' => '',
'collapse' => 0,
'firstline' => 1,
'gutter' => 0,
'htmlscript' => 0,
'light' => 0,
'padlinenumbers' => 'false',
'smarttabs' => 1,
'tabsize' => 4,
'toolbar' => 0,
'wraplines' => 1, // 2.x only
) );
© 2022 - 2024 — McMap. All rights reserved.