mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-06-11 03:32:46 +08:00
[DevFilePreview]JSON: Don't escape HTML-sensitive characters (#23054)
This commit is contained in:
parent
473e5dbf75
commit
ad18765ebc
@ -2,6 +2,7 @@
|
|||||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||||
// See the LICENSE file in the project root for more information.
|
// See the LICENSE file in the project root for more information.
|
||||||
|
|
||||||
|
using System.Text.Encodings.Web;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
|
||||||
namespace Microsoft.PowerToys.PreviewHandler.Monaco.Formatters
|
namespace Microsoft.PowerToys.PreviewHandler.Monaco.Formatters
|
||||||
@ -21,7 +22,11 @@ namespace Microsoft.PowerToys.PreviewHandler.Monaco.Formatters
|
|||||||
|
|
||||||
using (var jDocument = JsonDocument.Parse(value, new JsonDocumentOptions { CommentHandling = JsonCommentHandling.Skip }))
|
using (var jDocument = JsonDocument.Parse(value, new JsonDocumentOptions { CommentHandling = JsonCommentHandling.Skip }))
|
||||||
{
|
{
|
||||||
return JsonSerializer.Serialize(jDocument, new JsonSerializerOptions { WriteIndented = true });
|
return JsonSerializer.Serialize(jDocument, new JsonSerializerOptions
|
||||||
|
{
|
||||||
|
WriteIndented = true,
|
||||||
|
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user