Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e25a3c1

Browse files
committed
修复 textarea 的渲染问题
1 parent 2b4433b commit e25a3c1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

‎routes/article.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,15 @@ async function addArticle(req, res, next) {
3636
if (linesLength) {
3737
html += '<b class="name">' + lang + '</b>'
3838
}
39-
return `<pre ><code>${html}</code>${linesNum}</pre><textarea style="position: absolute;top: -9999px;left: -9999px;z-index: -9999;" id="copy${codeIndex}">${str}</textarea>`
39+
return `<pre class="hljs"><code>${html}</code>${linesNum}</pre><textarea style="position: absolute;top: -9999px;left: -9999px;z-index: -9999;" id="copy${codeIndex}">${str.replace(/<\/textarea>/g,'&lt;textarea>')}</textarea>`
4040
} catch (error) {
4141
console.log(error)
4242
}
4343
}
4444

4545
const preCode = md.utils.escapeHtml(str)
4646
html = html + preCode
47-
return `<pre class="hljs"><code>${html}</code>${linesNum}</pre><textarea style="position: absolute;top: -9999px;left: -9999px;z-index: -9999;" id="copy${codeIndex}">${str}</textarea>`
47+
return `<pre class="hljs"><code>${html}</code>${linesNum}</pre><textarea style="position: absolute;top: -9999px;left: -9999px;z-index: -9999;" id="copy${codeIndex}">${str.replace(/<\/textarea>/g,'&lt;textarea>')}</textarea>`
4848
}
4949
})
5050
let articleContentHtml = md.use(markdownItTocAndAnchor, {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /