如何改变美化类prettyprint到我们喜欢的其他类名?

时间:2016-03-13 07:35:41

标签: javascript php css

我在我的博客上使用Syntax Highlighter来美化代码。现在我想将其更改为Google Open Source Prettify。

在语法HighLighter中,我们通过调用<pre class="prettyprint">突出显示代码但在Google Prettify中它是<pre class="brush: js;">

因此,在我的博客上用<pre class="prettyprint">替换 string path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); if (Directory.Exist (path + @"\mspaint.exe")) { Controller.ExamController.AddExam(1, n, 7, time, Session.currentUserId); } else { Controller.ExamController.AddExam(1, n, 0, time, Session.currentUserId); } 非常困难。是否有任何方法可以替换或更改语法荧光笔的类名,而Prettify是可以理解的。

1 个答案:

答案 0 :(得分:1)

只需按住pre标记并从中删除所有类,然后将prettyprint添加到其中。只是一行代码。

$(document).ready(function() {
    $("pre").removeClass().addClass('prettyprint');
 });