mirror of
https://github.com/Redocly/redoc.git
synced 2025-02-14 17:00:33 +03:00
parent
7849f7f6b7
commit
58cb20d4b2
|
@ -20,8 +20,8 @@ function htmlEncode(t) {
|
||||||
: '';
|
: '';
|
||||||
}
|
}
|
||||||
|
|
||||||
function escapeForStringLiteral(str: string) {
|
function stringifyStringLiteral(str: string) {
|
||||||
return str.replace(/([\\"])/g, '\\$1');
|
return JSON.stringify(str).slice(1, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
function decorateWithSpan(value, className) {
|
function decorateWithSpan(value, className) {
|
||||||
|
@ -56,11 +56,11 @@ function valueToHTML(value, maxExpandLevel: number) {
|
||||||
'<a href="' +
|
'<a href="' +
|
||||||
value +
|
value +
|
||||||
'">' +
|
'">' +
|
||||||
htmlEncode(escapeForStringLiteral(value)) +
|
htmlEncode(stringifyStringLiteral(value)) +
|
||||||
'</a>' +
|
'</a>' +
|
||||||
decorateWithSpan('"', 'token string');
|
decorateWithSpan('"', 'token string');
|
||||||
} else {
|
} else {
|
||||||
output += decorateWithSpan('"' + escapeForStringLiteral(value) + '"', 'token string');
|
output += decorateWithSpan('"' + stringifyStringLiteral(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