从 SyntaxHighlighter 中删除行号

发布于 2024-07-16 04:01:39 字数 126 浏览 13 评论 0原文

有没有办法删除 SyntaxHighlighter 的行号?

谢谢!

Is there any way to remove the line numbers of SyntaxHighlighter?

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

情深已缘浅 2024-07-23 04:01:39

您可以将 SyntaxHighliter 的装订线配置设置为 false。 这将从您的代码中删除行号。

<pre class="brush: java; gutter: false;"></pre>

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>
请帮我爱他 2024-07-23 04:01:39

点击“查看普通”链接?

看一下 SyntaxHighlighter 演示,您会发现它的右上角有一些按钮,您可以使用这些按钮可以单击将代码复制到剪贴板,查看实际的源代码(删除标记)和/或打印它。

您是否在问我们如何删除添加行号的实际功能,同时仍保留其余功能? 您要求我们为您做这件事吗?

回应评论:

如果您想保留功能,只删除行号,您将需要自己下载 javascript 文件的副本,并删除您不需要的功能。 SyntaxHighlighter 下载页面允许您下载自己的荧光笔版本,它还告诉您它是根据 LGPL 3 获得许可的,这意味着您在进行和使用修改时必须遵循这些规则。

如果您愿意,如果您陷入某个特定位置,您可以回来询问个别 Javascript 问题,但我们不是 TopCoder,也不会为您重新编写代码。

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.

太阳哥哥 2024-07-23 04:01:39

如果您不想编辑现有标记,可以通过编辑 shCore.js 文件将其全局关闭:

var sh = {
defaults : {

    ...
    ...
    ...

    /** Enables or disables gutter. */
    'gutter' : false,

    ...
    ...
    ...

},

...
...
...
}

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,

    ...
    ...
    ...

},

...
...
...
}
夏尔 2024-07-23 04:01:39

您可以设置默认的 'gutter' => 通过编辑文件syntaxhighlighter.php,在 SyntaxHighlighter Evolved 版本 3.2.1 中更新 0。 在文件中查找此内容:

// 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
        ) );

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
        ) );
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文