我想将这段代码放入Jade(缩进是一个标签):
function isSafe(number) {
return /^\d+(\.\d+)?(e\d+)?$/i.test(number);
}
typeof number === 'string' && isSafe(number) && typeof eval(number) !== 'number'
当我这样做时,空行消失:
pre
code
| function isSafe(number) {
| return /^\d+(\.\d+)?(e\d+)?$/i.test(number);
| }
| typeof number === 'string' && isSafe(number) && typeof eval(number) !== 'number'
当我这样做时,管道显示出来:
pre
code
| function isSafe(number) {
| return /^\d+(\.\d+)?(e\d+)?$/i.test(number);
| }
|
| typeof number === 'string' && isSafe(number) && typeof eval(number) !== 'number'
当我这样做时,标签会变成一个空格:
pre
code.
function isSafe(number) {
return /^\d+(\.\d+)?(e\d+)?$/i.test(number);
}
typeof number === 'string' && isSafe(number) && typeof eval(number) !== 'number'
标记它的正确方法是什么?
答案 0 :(得分:3)
原来管道后面需要一个空格:
pre
code
| function isSafe(number) {
| return /^\d+(\.\d+)?(e\d+)?$/i.test(number);
| }
|·← here
| typeof number === 'string' && isSafe(number) && typeof eval(number) !== 'number'