Skip to content

Commit 71d2ec8

Browse files
committed
Fix double escaping
1 parent 9b5b2d0 commit 71d2ec8

File tree

4 files changed

+16
-12
lines changed

4 files changed

+16
-12
lines changed

javascript/TocCards.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { html } from "hono/html";
1+
import { html, raw } from "hono/html";
22
import type { FC } from "hono/jsx";
33

44
type HeaderCardProps = {
@@ -36,7 +36,9 @@ export const IndexHeaderCard: FC<HeaderCardProps> = ({
3636
&#x25BC;
3737
<!-- ▼ (because the corresponding one is not rendered) -->
3838
</a>
39-
<a href="${toIndexFolder}${chapterIndex}.html">${displayTitle}</a>
39+
<a href="${raw(toIndexFolder)}${chapterIndex}.html"
40+
>${raw(displayTitle)}</a
41+
>
4042
</h5>
4143
</div>`;
4244
};
@@ -69,7 +71,9 @@ export const SidebarHeaderCard: FC<HeaderCardProps> = ({
6971
&#x25BC;
7072
<!-- ▼ (because the corresponding one is not rendered) -->
7173
</a>
72-
<a href="${toIndexFolder}${chapterIndex}.html">${displayTitle}</a>
74+
<a href="${raw(toIndexFolder)}${chapterIndex}.html"
75+
>${raw(displayTitle)}</a
76+
>
7377
</h5>
7478
</div>`;
7579
};

javascript/generateTocHtml.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import LinksHead from "./html/LinksHead.js";
99
import Licences from "./html/Licences.js";
1010
import { generateChapterIndex } from "./tocUtils.js";
1111
import { IndexHeaderCard, SidebarHeaderCard } from "./TocCards.js";
12-
import { html } from "hono/html";
12+
import { html, raw } from "hono/html";
1313
import type { WriteBuffer } from "./types.js";
1414

1515
const truncateTitle = chapterTitle => {
@@ -109,8 +109,8 @@ export const recursiveProcessTOC = (
109109
aria-expanded="false"
110110
aria-controls="index-collapse-${index + 1}"
111111
>
112-
<a href="${toIndexFolder}${chapterIndex}.html">
113-
${displayTitle}</a
112+
<a href="${raw(toIndexFolder)}${chapterIndex}.html">
113+
${raw(displayTitle)}</a
114114
>
115115
</span>
116116
</h5>
@@ -129,8 +129,8 @@ export const recursiveProcessTOC = (
129129
aria-expanded="false"
130130
aria-controls="sidebar-collapse-${index + 1}"
131131
>
132-
<a href="${toIndexFolder}${chapterIndex}.html">
133-
${displayTitle}</a
132+
<a href="${raw(toIndexFolder)}${chapterIndex}.html">
133+
${raw(displayTitle)}</a
134134
>
135135
</span>
136136
</h5>

javascript/html/LinksHead.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { html } from "hono/html";
1+
import { html, raw } from "hono/html";
22
import type { FC } from "hono/jsx";
33

44
const HtmlHeadPart1: FC = () => {
@@ -119,7 +119,7 @@ const LinksHead: FC<LinksHeadProps> = ({
119119
}) => {
120120
return html`
121121
<head>
122-
${(<HtmlHeadPart1 />)} ${children}
122+
${(<HtmlHeadPart1 />)} ${raw(children)}
123123
${(<HtmlHeadPart2 toIndexFolder={toIndexFolder} />)}
124124
</head>
125125
`;

javascript/html/Navigation.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { html } from "hono/html";
1+
import { html, raw } from "hono/html";
22
import type { FC } from "hono/jsx";
33

44
const NavigationElements: FC = () => {
@@ -61,7 +61,7 @@ const Navigation: FC = () => {
6161
</button>
6262
<span class="toolt"
6363
>Legend<span class="toolttext">
64-
${(<NavigationElements />)}
64+
${raw(<NavigationElements />)}
6565
</span></span
6666
>
6767
</nav>`;

0 commit comments

Comments
 (0)