Skip to content

Commit 769751c

Browse files
committed
chore: downgrade escaping
1 parent c652a0d commit 769751c

File tree

5 files changed

+62
-72
lines changed

5 files changed

+62
-72
lines changed

src/pages/document.ts

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -117,21 +117,11 @@ function getMetadata(metadata: VarsMetadata | undefined, restMeta: LeadingPage['
117117
}
118118

119119
function escapeJsonForHtml(json: unknown): string {
120-
return JSON.stringify(json)
121-
.replace(/&/g, '&')
122-
.replace(/</g, '&lt;')
123-
.replace(/>/g, '&gt;')
124-
.replace(/"/g, '&quot;')
125-
.replace(/'/g, '&#x27;');
120+
return JSON.stringify(json).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
126121
}
127122

128123
function unescapeJsonFromHtml(escaped: string): unknown {
129-
const unescaped = escaped
130-
.replace(/&#x27;/g, "'")
131-
.replace(/&quot;/g, '"')
132-
.replace(/&lt;/g, '<')
133-
.replace(/&gt;/g, '>')
134-
.replace(/&amp;/g, '&');
124+
const unescaped = escaped.replace(/&lt;/g, '<').replace(/&gt;/g, '>').replace(/&amp;/g, '&');
135125

136126
return JSON.parse(unescaped);
137127
}

tests/e2e/__snapshots__/load-custom-resources.spec.ts.snap

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,11 @@ exports[`Allow load custom resources md2html single page with custom resources:
8686
<script type="application/json"
8787
id="diplodoc-state"
8888
>
89-
{&quot;data&quot;:{&quot;data&quot;:{&quot;title&quot;:&quot;Documentation&quot;,&quot;description&quot;:&quot;&quot;,&quot;meta&quot;:{&quot;metadata&quot;:[{&quot;name&quot;:&quot;generator&quot;,&quot;content&quot;:&quot;Diplodoc Platform v4.57.8&quot;}],&quot;style&quot;:[&quot;_assets/style/test.css&quot;],&quot;script&quot;:[&quot;_assets/script/test1.js&quot;],&quot;title&quot;:&quot;Documentation&quot;,&quot;noIndex&quot;:true},&quot;links&quot;:[{&quot;title&quot;:&quot;Getting started with Documentation&quot;,&quot;description&quot;:&quot;This guide will show you the basics of working with Documentation&quot;,&quot;href&quot;:&quot;page.html&quot;}]},&quot;meta&quot;:{&quot;metadata&quot;:[{&quot;name&quot;:&quot;generator&quot;,&quot;content&quot;:&quot;Diplodoc Platform v4.57.8&quot;}],&quot;style&quot;:[&quot;_assets/style/test.css&quot;],&quot;script&quot;:[&quot;_assets/script/test1.js&quot;],&quot;title&quot;:&quot;Documentation&quot;,&quot;noIndex&quot;:true},&quot;title&quot;:&quot;Documentation&quot;,&quot;leading&quot;:true},&quot;router&quot;:{&quot;pathname&quot;:&quot;index&quot;,&quot;depth&quot;:1},&quot;lang&quot;:&quot;ru&quot;,&quot;langs&quot;:[&quot;ru&quot;]}
89+
{"data":{"data":{"title":"Documentation","description":"","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"style":["_assets/style/test.css"],"script":["_assets/script/test1.js"],"title":"Documentation","noIndex":true},"links":[{"title":"Getting started with Documentation","description":"This guide will show you the basics of working with Documentation","href":"page.html"}]},"meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"style":["_assets/style/test.css"],"script":["_assets/script/test1.js"],"title":"Documentation","noIndex":true},"title":"Documentation","leading":true},"router":{"pathname":"index","depth":1},"lang":"ru","langs":["ru"]}
9090
</script>
9191
<script type="application/javascript">
9292
function unescapeJsonFromHtml(escaped) {
93-
const unescaped = escaped.replace(/&#x27;/g, "'").replace(/&quot;/g, '"').replace(/&lt;/g, "
93+
const unescaped = escaped.replace(/&lt;/g, "
9494
<").replace(/&gt;/g, ">").replace(/&amp;/g, "&");
9595
return JSON.parse(unescaped);
9696
}
@@ -165,11 +165,11 @@ exports[`Allow load custom resources md2html single page with custom resources:
165165
<script type="application/json"
166166
id="diplodoc-state"
167167
>
168-
{&quot;data&quot;:{&quot;meta&quot;:{&quot;metadata&quot;:[{&quot;name&quot;:&quot;generator&quot;,&quot;content&quot;:&quot;Diplodoc Platform v4.57.8&quot;},{&quot;name&quot;:&quot;yfm&quot;,&quot;content&quot;:&quot;builder&quot;}],&quot;style&quot;:[&quot;_assets/style/test.css&quot;],&quot;script&quot;:[&quot;_assets/script/test1.js&quot;]},&quot;assets&quot;:[],&quot;headings&quot;:[],&quot;title&quot;:&quot;&quot;,&quot;includes&quot;:[],&quot;html&quot;:&quot;&lt;p&gt;Lorem&lt;/p&gt;/n&quot;,&quot;leading&quot;:false},&quot;router&quot;:{&quot;pathname&quot;:&quot;page&quot;,&quot;depth&quot;:1},&quot;lang&quot;:&quot;ru&quot;,&quot;langs&quot;:[&quot;ru&quot;]}
168+
{"data":{"meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"},{"name":"yfm","content":"builder"}],"style":["_assets/style/test.css"],"script":["_assets/script/test1.js"]},"assets":[],"headings":[],"title":"","includes":[],"html":"&lt;p&gt;Lorem&lt;/p&gt;/n","leading":false},"router":{"pathname":"page","depth":1},"lang":"ru","langs":["ru"]}
169169
</script>
170170
<script type="application/javascript">
171171
function unescapeJsonFromHtml(escaped) {
172-
const unescaped = escaped.replace(/&#x27;/g, "'").replace(/&quot;/g, '"').replace(/&lt;/g, "
172+
const unescaped = escaped.replace(/&lt;/g, "
173173
<").replace(/&gt;/g, ">").replace(/&amp;/g, "&");
174174
return JSON.parse(unescaped);
175175
}
@@ -241,11 +241,11 @@ exports[`Allow load custom resources md2html single page with custom resources:
241241
<script type="application/json"
242242
id="diplodoc-state"
243243
>
244-
{&quot;data&quot;:{&quot;meta&quot;:{&quot;metadata&quot;:[{&quot;name&quot;:&quot;generator&quot;,&quot;content&quot;:&quot;Diplodoc Platform v4.57.8&quot;}],&quot;style&quot;:[&quot;_assets/style/test.css&quot;],&quot;script&quot;:[&quot;_assets/script/test1.js&quot;]},&quot;assets&quot;:[],&quot;headings&quot;:[],&quot;title&quot;:&quot;&quot;,&quot;includes&quot;:[],&quot;html&quot;:&quot;&lt;p&gt;Lorem&lt;/p&gt;/n&quot;,&quot;leading&quot;:false},&quot;router&quot;:{&quot;pathname&quot;:&quot;project/config&quot;,&quot;depth&quot;:2},&quot;lang&quot;:&quot;ru&quot;,&quot;langs&quot;:[&quot;ru&quot;]}
244+
{"data":{"meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"style":["_assets/style/test.css"],"script":["_assets/script/test1.js"]},"assets":[],"headings":[],"title":"","includes":[],"html":"&lt;p&gt;Lorem&lt;/p&gt;/n","leading":false},"router":{"pathname":"project/config","depth":2},"lang":"ru","langs":["ru"]}
245245
</script>
246246
<script type="application/javascript">
247247
function unescapeJsonFromHtml(escaped) {
248-
const unescaped = escaped.replace(/&#x27;/g, "'").replace(/&quot;/g, '"').replace(/&lt;/g, "
248+
const unescaped = escaped.replace(/&lt;/g, "
249249
<").replace(/&gt;/g, ">").replace(/&amp;/g, "&");
250250
return JSON.parse(unescaped);
251251
}
@@ -314,11 +314,11 @@ exports[`Allow load custom resources md2html single page with custom resources:
314314
<script type="application/json"
315315
id="diplodoc-state"
316316
>
317-
{&quot;data&quot;:{&quot;leading&quot;:false,&quot;html&quot;:&quot;&lt;p&gt;Lorem&lt;/p&gt;/n&lt;hr class=/&quot;yfm-page__delimeter/&quot;&gt;&lt;p&gt;Lorem&lt;/p&gt;/n&quot;,&quot;headings&quot;:[],&quot;meta&quot;:{&quot;style&quot;:[&quot;_assets/style/test.css&quot;],&quot;script&quot;:[&quot;_assets/script/test1.js&quot;]},&quot;title&quot;:&quot;Documentation&quot;},&quot;router&quot;:{&quot;pathname&quot;:&quot;single-page.html&quot;,&quot;depth&quot;:2,&quot;base&quot;:&quot;../&quot;},&quot;lang&quot;:&quot;ru&quot;,&quot;langs&quot;:[&quot;ru&quot;]}
317+
{"data":{"leading":false,"html":"&lt;p&gt;Lorem&lt;/p&gt;/n&lt;hr class=\\"yfm-page__delimeter\\"&gt;&lt;p&gt;Lorem&lt;/p&gt;/n","headings":[],"meta":{"style":["_assets/style/test.css"],"script":["_assets/script/test1.js"]},"title":"Documentation"},"router":{"pathname":"single-page.html","depth":2,"base":"../"},"lang":"ru","langs":["ru"]}
318318
</script>
319319
<script type="application/javascript">
320320
function unescapeJsonFromHtml(escaped) {
321-
const unescaped = escaped.replace(/&#x27;/g, "'").replace(/&quot;/g, '"').replace(/&lt;/g, "
321+
const unescaped = escaped.replace(/&lt;/g, "
322322
<").replace(/&gt;/g, ">").replace(/&amp;/g, "&");
323323
return JSON.parse(unescaped);
324324
}
@@ -435,11 +435,11 @@ exports[`Allow load custom resources md2html with custom resources: index.html 1
435435
<script type="application/json"
436436
id="diplodoc-state"
437437
>
438-
{&quot;data&quot;:{&quot;data&quot;:{&quot;title&quot;:&quot;Documentation&quot;,&quot;description&quot;:&quot;&quot;,&quot;meta&quot;:{&quot;metadata&quot;:[{&quot;name&quot;:&quot;generator&quot;,&quot;content&quot;:&quot;Diplodoc Platform v4.57.8&quot;}],&quot;style&quot;:[&quot;_assets/style/test.css&quot;],&quot;script&quot;:[&quot;_assets/script/test1.js&quot;],&quot;title&quot;:&quot;Documentation&quot;,&quot;noIndex&quot;:true},&quot;links&quot;:[{&quot;title&quot;:&quot;Getting started with Documentation&quot;,&quot;description&quot;:&quot;This guide will show you the basics of working with Documentation&quot;,&quot;href&quot;:&quot;page.html&quot;}]},&quot;meta&quot;:{&quot;metadata&quot;:[{&quot;name&quot;:&quot;generator&quot;,&quot;content&quot;:&quot;Diplodoc Platform v4.57.8&quot;}],&quot;style&quot;:[&quot;_assets/style/test.css&quot;],&quot;script&quot;:[&quot;_assets/script/test1.js&quot;],&quot;title&quot;:&quot;Documentation&quot;,&quot;noIndex&quot;:true},&quot;title&quot;:&quot;Documentation&quot;,&quot;leading&quot;:true},&quot;router&quot;:{&quot;pathname&quot;:&quot;index&quot;,&quot;depth&quot;:1},&quot;lang&quot;:&quot;ru&quot;,&quot;langs&quot;:[&quot;ru&quot;]}
438+
{"data":{"data":{"title":"Documentation","description":"","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"style":["_assets/style/test.css"],"script":["_assets/script/test1.js"],"title":"Documentation","noIndex":true},"links":[{"title":"Getting started with Documentation","description":"This guide will show you the basics of working with Documentation","href":"page.html"}]},"meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"style":["_assets/style/test.css"],"script":["_assets/script/test1.js"],"title":"Documentation","noIndex":true},"title":"Documentation","leading":true},"router":{"pathname":"index","depth":1},"lang":"ru","langs":["ru"]}
439439
</script>
440440
<script type="application/javascript">
441441
function unescapeJsonFromHtml(escaped) {
442-
const unescaped = escaped.replace(/&#x27;/g, "'").replace(/&quot;/g, '"').replace(/&lt;/g, "
442+
const unescaped = escaped.replace(/&lt;/g, "
443443
<").replace(/&gt;/g, ">").replace(/&amp;/g, "&");
444444
return JSON.parse(unescaped);
445445
}
@@ -514,11 +514,11 @@ exports[`Allow load custom resources md2html with custom resources: page.html 1`
514514
<script type="application/json"
515515
id="diplodoc-state"
516516
>
517-
{&quot;data&quot;:{&quot;meta&quot;:{&quot;metadata&quot;:[{&quot;name&quot;:&quot;generator&quot;,&quot;content&quot;:&quot;Diplodoc Platform v4.57.8&quot;},{&quot;name&quot;:&quot;yfm&quot;,&quot;content&quot;:&quot;builder&quot;}],&quot;style&quot;:[&quot;_assets/style/test.css&quot;],&quot;script&quot;:[&quot;_assets/script/test1.js&quot;]},&quot;assets&quot;:[],&quot;headings&quot;:[],&quot;title&quot;:&quot;&quot;,&quot;includes&quot;:[],&quot;html&quot;:&quot;&lt;p&gt;Lorem&lt;/p&gt;/n&quot;,&quot;leading&quot;:false},&quot;router&quot;:{&quot;pathname&quot;:&quot;page&quot;,&quot;depth&quot;:1},&quot;lang&quot;:&quot;ru&quot;,&quot;langs&quot;:[&quot;ru&quot;]}
517+
{"data":{"meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"},{"name":"yfm","content":"builder"}],"style":["_assets/style/test.css"],"script":["_assets/script/test1.js"]},"assets":[],"headings":[],"title":"","includes":[],"html":"&lt;p&gt;Lorem&lt;/p&gt;/n","leading":false},"router":{"pathname":"page","depth":1},"lang":"ru","langs":["ru"]}
518518
</script>
519519
<script type="application/javascript">
520520
function unescapeJsonFromHtml(escaped) {
521-
const unescaped = escaped.replace(/&#x27;/g, "'").replace(/&quot;/g, '"').replace(/&lt;/g, "
521+
const unescaped = escaped.replace(/&lt;/g, "
522522
<").replace(/&gt;/g, ">").replace(/&amp;/g, "&");
523523
return JSON.parse(unescaped);
524524
}
@@ -590,11 +590,11 @@ exports[`Allow load custom resources md2html with custom resources: project/conf
590590
<script type="application/json"
591591
id="diplodoc-state"
592592
>
593-
{&quot;data&quot;:{&quot;meta&quot;:{&quot;metadata&quot;:[{&quot;name&quot;:&quot;generator&quot;,&quot;content&quot;:&quot;Diplodoc Platform v4.57.8&quot;}],&quot;style&quot;:[&quot;_assets/style/test.css&quot;],&quot;script&quot;:[&quot;_assets/script/test1.js&quot;]},&quot;assets&quot;:[],&quot;headings&quot;:[],&quot;title&quot;:&quot;&quot;,&quot;includes&quot;:[],&quot;html&quot;:&quot;&lt;p&gt;Lorem&lt;/p&gt;/n&quot;,&quot;leading&quot;:false},&quot;router&quot;:{&quot;pathname&quot;:&quot;project/config&quot;,&quot;depth&quot;:2},&quot;lang&quot;:&quot;ru&quot;,&quot;langs&quot;:[&quot;ru&quot;]}
593+
{"data":{"meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"}],"style":["_assets/style/test.css"],"script":["_assets/script/test1.js"]},"assets":[],"headings":[],"title":"","includes":[],"html":"&lt;p&gt;Lorem&lt;/p&gt;/n","leading":false},"router":{"pathname":"project/config","depth":2},"lang":"ru","langs":["ru"]}
594594
</script>
595595
<script type="application/javascript">
596596
function unescapeJsonFromHtml(escaped) {
597-
const unescaped = escaped.replace(/&#x27;/g, "'").replace(/&quot;/g, '"').replace(/&lt;/g, "
597+
const unescaped = escaped.replace(/&lt;/g, "
598598
<").replace(/&gt;/g, ">").replace(/&amp;/g, "&");
599599
return JSON.parse(unescaped);
600600
}

tests/e2e/__snapshots__/metadata.spec.ts.snap

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ exports[`Allow load custom resources md2html with metadata: index.html 1`] = `
7070
<script type="application/json"
7171
id="diplodoc-state"
7272
>
73-
{&quot;data&quot;:{&quot;data&quot;:{&quot;title&quot;:&quot;Documentation&quot;,&quot;description&quot;:&quot;&quot;,&quot;meta&quot;:{&quot;metadata&quot;:[{&quot;name&quot;:&quot;generator&quot;,&quot;content&quot;:&quot;Diplodoc Platform v4.57.8&quot;},{&quot;name&quot;:&quot;test-yfm&quot;,&quot;content&quot;:&quot;inline test&quot;},{&quot;name&quot;:&quot;yfm-config&quot;,&quot;content&quot;:&quot;config test&quot;}],&quot;title&quot;:&quot;Documentation&quot;,&quot;noIndex&quot;:true},&quot;links&quot;:[{&quot;title&quot;:&quot;Getting started with Documentation&quot;,&quot;description&quot;:&quot;This guide will show you the basics of working with Documentation&quot;,&quot;href&quot;:&quot;page.html&quot;}]},&quot;meta&quot;:{&quot;metadata&quot;:[{&quot;name&quot;:&quot;generator&quot;,&quot;content&quot;:&quot;Diplodoc Platform v4.57.8&quot;},{&quot;name&quot;:&quot;test-yfm&quot;,&quot;content&quot;:&quot;inline test&quot;},{&quot;name&quot;:&quot;yfm-config&quot;,&quot;content&quot;:&quot;config test&quot;}],&quot;title&quot;:&quot;Documentation&quot;,&quot;noIndex&quot;:true},&quot;title&quot;:&quot;Documentation&quot;,&quot;leading&quot;:true},&quot;router&quot;:{&quot;pathname&quot;:&quot;index&quot;,&quot;depth&quot;:1},&quot;lang&quot;:&quot;ru&quot;,&quot;langs&quot;:[&quot;ru&quot;]}
73+
{"data":{"data":{"title":"Documentation","description":"","meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"},{"name":"test-yfm","content":"inline test"},{"name":"yfm-config","content":"config test"}],"title":"Documentation","noIndex":true},"links":[{"title":"Getting started with Documentation","description":"This guide will show you the basics of working with Documentation","href":"page.html"}]},"meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"},{"name":"test-yfm","content":"inline test"},{"name":"yfm-config","content":"config test"}],"title":"Documentation","noIndex":true},"title":"Documentation","leading":true},"router":{"pathname":"index","depth":1},"lang":"ru","langs":["ru"]}
7474
</script>
7575
<script type="application/javascript">
7676
function unescapeJsonFromHtml(escaped) {
77-
const unescaped = escaped.replace(/&#x27;/g, "'").replace(/&quot;/g, '"').replace(/&lt;/g, "
77+
const unescaped = escaped.replace(/&lt;/g, "
7878
<").replace(/&gt;/g, ">").replace(/&amp;/g, "&");
7979
return JSON.parse(unescaped);
8080
}
@@ -148,11 +148,11 @@ exports[`Allow load custom resources md2html with metadata: page.html 1`] = `
148148
<script type="application/json"
149149
id="diplodoc-state"
150150
>
151-
{&quot;data&quot;:{&quot;meta&quot;:{&quot;metadata&quot;:[{&quot;name&quot;:&quot;generator&quot;,&quot;content&quot;:&quot;Diplodoc Platform v4.57.8&quot;},{&quot;name&quot;:&quot;test-yfm&quot;,&quot;content&quot;:&quot;inline test&quot;},{&quot;name&quot;:&quot;yfm-config&quot;,&quot;content&quot;:&quot;config test&quot;},{&quot;name&quot;:&quot;yfm&quot;,&quot;value&quot;:&quot;builder in page&quot;}]},&quot;assets&quot;:[],&quot;headings&quot;:[],&quot;title&quot;:&quot;&quot;,&quot;includes&quot;:[],&quot;html&quot;:&quot;&lt;p&gt;Lorem&lt;/p&gt;/n&quot;,&quot;leading&quot;:false},&quot;router&quot;:{&quot;pathname&quot;:&quot;page&quot;,&quot;depth&quot;:1},&quot;lang&quot;:&quot;ru&quot;,&quot;langs&quot;:[&quot;ru&quot;]}
151+
{"data":{"meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"},{"name":"test-yfm","content":"inline test"},{"name":"yfm-config","content":"config test"},{"name":"yfm","value":"builder in page"}]},"assets":[],"headings":[],"title":"","includes":[],"html":"&lt;p&gt;Lorem&lt;/p&gt;/n","leading":false},"router":{"pathname":"page","depth":1},"lang":"ru","langs":["ru"]}
152152
</script>
153153
<script type="application/javascript">
154154
function unescapeJsonFromHtml(escaped) {
155-
const unescaped = escaped.replace(/&#x27;/g, "'").replace(/&quot;/g, '"').replace(/&lt;/g, "
155+
const unescaped = escaped.replace(/&lt;/g, "
156156
<").replace(/&gt;/g, ">").replace(/&amp;/g, "&");
157157
return JSON.parse(unescaped);
158158
}
@@ -226,11 +226,11 @@ exports[`Allow load custom resources md2html with metadata: project/config.html
226226
<script type="application/json"
227227
id="diplodoc-state"
228228
>
229-
{&quot;data&quot;:{&quot;meta&quot;:{&quot;metadata&quot;:[{&quot;name&quot;:&quot;generator&quot;,&quot;content&quot;:&quot;Diplodoc Platform v4.57.8&quot;},{&quot;name&quot;:&quot;test-yfm&quot;,&quot;content&quot;:&quot;inline test&quot;},{&quot;name&quot;:&quot;yfm-config&quot;,&quot;content&quot;:&quot;config test&quot;},{&quot;name&quot;:&quot;yfm&quot;,&quot;value&quot;:&quot;builder in config&quot;}]},&quot;assets&quot;:[],&quot;headings&quot;:[],&quot;title&quot;:&quot;&quot;,&quot;includes&quot;:[],&quot;html&quot;:&quot;&lt;p&gt;Lorem&lt;/p&gt;/n&quot;,&quot;leading&quot;:false},&quot;router&quot;:{&quot;pathname&quot;:&quot;project/config&quot;,&quot;depth&quot;:2},&quot;lang&quot;:&quot;ru&quot;,&quot;langs&quot;:[&quot;ru&quot;]}
229+
{"data":{"meta":{"metadata":[{"name":"generator","content":"Diplodoc Platform vDIPLODOC-VERSION"},{"name":"test-yfm","content":"inline test"},{"name":"yfm-config","content":"config test"},{"name":"yfm","value":"builder in config"}]},"assets":[],"headings":[],"title":"","includes":[],"html":"&lt;p&gt;Lorem&lt;/p&gt;/n","leading":false},"router":{"pathname":"project/config","depth":2},"lang":"ru","langs":["ru"]}
230230
</script>
231231
<script type="application/javascript">
232232
function unescapeJsonFromHtml(escaped) {
233-
const unescaped = escaped.replace(/&#x27;/g, "'").replace(/&quot;/g, '"').replace(/&lt;/g, "
233+
const unescaped = escaped.replace(/&lt;/g, "
234234
<").replace(/&gt;/g, ">").replace(/&amp;/g, "&");
235235
return JSON.parse(unescaped);
236236
}

0 commit comments

Comments
 (0)