escaping html code also in chatgpt web integration. see #711
This commit is contained in:
parent
1d8543627e
commit
5301d1c898
1 changed files with 10 additions and 1 deletions
|
|
@ -285,10 +285,19 @@ function convertBrToNewlines(html) {
|
||||||
export function convertNewlinesToParagraphs(input) {
|
export function convertNewlinesToParagraphs(input) {
|
||||||
return input
|
return input
|
||||||
.split('\n')
|
.split('\n')
|
||||||
.map(line => `<p>${line}</p>`)
|
.map(line => `<p>${escapeHtml(line)}</p>`)
|
||||||
.join('');
|
.join('');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function escapeHtml(text) {
|
||||||
|
return text
|
||||||
|
.replace(/&/g, '&')
|
||||||
|
.replace(/</g, '<')
|
||||||
|
.replace(/>/g, '>')
|
||||||
|
.replace(/"/g, '"')
|
||||||
|
.replace(/'/g, ''');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// This method is used to convert the model string id used in the URL
|
// This method is used to convert the model string id used in the URL
|
||||||
// to the model string used in the webpage
|
// to the model string used in the webpage
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue