您好我正在使用谷歌美化插件
我正在使用以下代码
<pre class="prettiprint">
Morris.Bar({
element: 'barchart',
axes: true,
data: Object.keys(json.bar).map(function(key) {return json.bar[key]}),
xkey: 'x',
ykeys: ['y', 'z', 'a'],
labels: ['Facebook', 'LinkedIn', 'Google+'],
barColors: ['#707f9b', '#455064', '#242d3c']
});
</pre>
但我得到以下输出
Morris.Bar({ element: 'barchart', axes: true, data: Object.keys(json.bar).map(function(key) {return json.bar[key]}), xkey: 'x', ykeys: ['y', 'z', 'a'], labels: ['Facebook', 'LinkedIn', 'Google+'], barColors: ['#707f9b', '#455064', '#242d3c'] });
我需要这样,
Morris.Bar({
element: 'barchart',
axes: true,
data: Object.keys(json.bar).map(function(key) {return json.bar[key]}),
xkey: 'x',
ykeys: ['y', 'z', 'a'],
labels: ['Facebook', 'LinkedIn', 'Google+'],
barColors: ['#707f9b', '#455064', '#242d3c']
});
答案 0 :(得分:0)
从this answer起,似乎将一些css规则应用于pre
将保留换行符
pre{
white-space: -moz-pre-wrap;
white-space: -o-pre-wrap;
white-space: pre-wrap;
word-wrap: break-word;
}