mirror of
https://github.com/Redocly/redoc.git
synced 2025-02-07 13:30:33 +03:00
parent
7849f7f6b7
commit
58cb20d4b2
|
@ -20,8 +20,8 @@ function htmlEncode(t) {
|
|||
: '';
|
||||
}
|
||||
|
||||
function escapeForStringLiteral(str: string) {
|
||||
return str.replace(/([\\"])/g, '\\$1');
|
||||
function stringifyStringLiteral(str: string) {
|
||||
return JSON.stringify(str).slice(1, -1);
|
||||
}
|
||||
|
||||
function decorateWithSpan(value, className) {
|
||||
|
@ -56,11 +56,11 @@ function valueToHTML(value, maxExpandLevel: number) {
|
|||
'<a href="' +
|
||||
value +
|
||||
'">' +
|
||||
htmlEncode(escapeForStringLiteral(value)) +
|
||||
htmlEncode(stringifyStringLiteral(value)) +
|
||||
'</a>' +
|
||||
decorateWithSpan('"', 'token string');
|
||||
} else {
|
||||
output += decorateWithSpan('"' + escapeForStringLiteral(value) + '"', 'token string');
|
||||
output += decorateWithSpan('"' + stringifyStringLiteral(value) + '"', 'token string');
|
||||
}
|
||||
} else if (valueType === 'boolean') {
|
||||
output += decorateWithSpan(value, 'token boolean');
|
||||
|
|
Loading…
Reference in New Issue
Block a user