【发布时间】:2016-09-11 12:05:15
【问题描述】:
我将一个 JavaScript 函数存储在没有空格的 DB 中。后来我从数据库中检索并使用 google prettify 在网页上显示,但 code-sn-p 显示在一行中,
var Pizza = function(size, toppingCodes) {
this.size = size;
this.toppingCodes = toppingCodes;
this.toString = function() {
return "A " + size + " pizza with " + this.toppingCodes + ".";
};
};
Pizza.prototype.getBaseCost = function() {
switch (this.size) {
case "small":
return 6.50;
case "medium":
return 7.50;
case "large":
return 8.50;
}
};
我通过使用 google 美化来获取关键字颜色等。 我可以以格式良好的方式显示上述 JS 函数吗?我们有这个工具/库吗??
【问题讨论】:
标签: javascript webpage code-snippets prettify