mirror of
https://github.com/Redocly/redoc.git
synced 2025-01-31 10:04:08 +03:00
parent
3659a75020
commit
04731656db
|
@ -21,6 +21,10 @@ function htmlEncode(t) {
|
||||||
: '';
|
: '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function escapeStringQuotes(str: string) {
|
||||||
|
return str.replace(/"/g, '\\"');
|
||||||
|
}
|
||||||
|
|
||||||
function decorateWithSpan(value, className) {
|
function decorateWithSpan(value, className) {
|
||||||
return '<span class="' + className + '">' + htmlEncode(value) + '</span>';
|
return '<span class="' + className + '">' + htmlEncode(value) + '</span>';
|
||||||
}
|
}
|
||||||
|
@ -53,11 +57,11 @@ function valueToHTML(value) {
|
||||||
'<a href="' +
|
'<a href="' +
|
||||||
value +
|
value +
|
||||||
'">' +
|
'">' +
|
||||||
htmlEncode(value) +
|
htmlEncode(escapeStringQuotes(value)) +
|
||||||
'</a>' +
|
'</a>' +
|
||||||
decorateWithSpan('"', 'token string');
|
decorateWithSpan('"', 'token string');
|
||||||
} else {
|
} else {
|
||||||
output += decorateWithSpan('"' + value + '"', 'token string');
|
output += decorateWithSpan('"' + escapeStringQuotes(value) + '"', 'token string');
|
||||||
}
|
}
|
||||||
} else if (valueType === 'boolean') {
|
} else if (valueType === 'boolean') {
|
||||||
output += decorateWithSpan(value, 'token boolean');
|
output += decorateWithSpan(value, 'token boolean');
|
||||||
|
|
Loading…
Reference in New Issue
Block a user