//代码展示方案一
var $button = $("<div class='source-button btn btn-success btn-xs'><></div>").click(
function () {
var html = $(this).parent().html()
var tmp = html.split(/\n/)
tmp.shift()
tmp.splice(-1, 1)
var indentSize = tmp[0].length - tmp[0].trim().length,
re = new RegExp(' {' + indentSize + '}')
tmp = tmp.map(function (line) {
if (line.match(re)) {
line = line.substring(indentSize)
}
return line
}<
html代码展示方案
最新推荐文章于 2023-07-27 21:12:30 发布