ChatGPT โฉ ่ชๆณ้ซไบฎๅฏฆ็พๆนๆณ
ไฝฟ็จไธๆนไป็ดน็ JavaScript ๅฝๅผๅบซๆ๏ผๅฆๆ <pre><code>
็ๅฏซๆณๅฆไธ๏ผ
<pre><code class="language-javascript">
function greet(name) {
console.log(`Hello, ${name}!`);
}
greet("World");
</code></pre>
ๅ็พๅบไพ็ๆจฃๅญๅ้ๆจฃ๏ผ
็ถฒ้ ไธๆนๆๅบ็พไธๅๅค้ค็็ฉบ็ฝๅ๏ผ้ๆฏๅ ็บ <pre>
ๆใไฟ็ๆๆ็ๆ่กๅ็ฉบ็ฝใ๏ผๅ
ๅซ <pre><code>
ๅพ้ข็ๆ่ก๏ผๅ ๆญคๅจ็ถฒ้ ไธๆๅ็พไธ่ก็ฉบ็ฝใ
๐ ่งฃๆฑบๆนๆณ
ๆๅ่ชฟๆด๏ผๅจ <pre><code>
ๅพ้ขๆฅ่ๆ๏ผๅฅ็ดๆฅๆ่กใ
<pre><code class="language-javascript">function greet(name) {
console.log(`Hello, ${name}!`);
}
greet("World");
</code></pre>
ไฝฟ็จ CSS โฉ white-space ่ชๅ่ชฟๆดๆจฃๅผ
pre {
/* ไฟ็ๆ่ก๏ผไฝๅป้คๅค้ค็ฉบ็ฝ */
white-space: pre-wrap;
}
๐ html
<head>
<link href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/themes/prism.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/prism.js"></script>
</head>
<body>
<pre><code class="language-javascript">function greet(name) {
console.log(`Hello, ${name}!`);
}
greet("World");
</code></pre>
</body>
๐ html
<head>
<link href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.8.0/styles/default.min.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.8.0/highlight.min.js"></script>
<script>hljs.highlightAll();</script>
</head>
<pre><code class="javascript">function greet(name) {
console.log(`Hello, ${name}!`);
}
greet("World");
</code></pre>