<div class="left">
<textarea></textarea>
</div>
<div class="right"></div>
HTML
格式化
支持Emmet,输入 p 后按 Tab键试试吧!
<head> ... </head>
<body>
</body>
/* 示例代码 */
body {
text-align: center;
padding: 10px 100px;
}
i {
color: #777;
}
.left textarea {
width: 100%;
height: 200px;
padding: 10px;
line-height: 1.7;
}
.right {
text-align: left;
font-size: 14px;
background: transparent;
line-height: 2;
margin: 0;
}
let s;
let w = "Carrier/aircraft manufacturer#Model/aircraft type#Endurance/flight hour#Maximum range/max range#Cabin altitude/Cabin height#Number of seats/passengers";
setInterval(() => {
[document.querySelector(".left textarea").value].forEach(a => {
if (s != a) {
s = a;
if (!s) return;
let q = s.split(/\n/g);
q = q.map(a => {
if (a.includes(":")) {
a = a.split(":");
w.split("#").forEach(b => {
b = b.split("/");
if (a[0] == b[0]) {
a[0] = b[1];
}
});
return a;
}
});
document.querySelector(".right").innerHTML = q.reduce((a, b) => a + b[0] + ": " + b[1] + "<br>", "");
}
});
}, 500);