Skip to content

Commit fc94a66

Browse files
committed
Extract RenderedHtml component
1 parent 491ac69 commit fc94a66

File tree

4 files changed

+39
-33
lines changed

4 files changed

+39
-33
lines changed

app/components/rendered-html.hbs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{{!--
2+
This component renders raw HTML. Be very careful with this since it
3+
can enable cross-site scripting attacks!
4+
--}}
5+
<div local-class="wrapper" ...attributes {{highlight-syntax selector="pre > code"}}>
6+
{{html-safe @html}}
7+
</div>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
.wrapper {
2+
line-height: 1.5;
3+
overflow-wrap: break-word;
4+
5+
img {
6+
max-width: 100%;
7+
}
8+
9+
pre {
10+
overflow-x: auto;
11+
}
12+
13+
p {
14+
code {
15+
background-color: #fff;
16+
padding: 0 2px;
17+
}
18+
}
19+
20+
table {
21+
border-collapse: collapse;
22+
display: block;
23+
overflow-x: auto;
24+
25+
th, td {
26+
border: 1px solid #dfe2e5;
27+
padding: 6px 13px;
28+
}
29+
}
30+
}

app/styles/crate/version.module.css

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -194,37 +194,6 @@ div.header {
194194
margin-bottom: 40px;
195195
}
196196

197-
.crate-readme {
198-
line-height: 1.5;
199-
overflow-wrap: break-word;
200-
201-
img {
202-
max-width: 100%;
203-
}
204-
205-
pre {
206-
overflow-x: auto;
207-
}
208-
209-
p {
210-
code {
211-
background-color: #fff;
212-
padding: 0 2px;
213-
}
214-
}
215-
216-
table {
217-
border-collapse: collapse;
218-
display: block;
219-
overflow-x: auto;
220-
221-
th, td {
222-
border: 1px solid #dfe2e5;
223-
padding: 6px 13px;
224-
}
225-
}
226-
}
227-
228197
.crate-downloads {
229198
display: flex;
230199
flex-wrap: wrap;

app/templates/crate/version.hbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@
6666
{{/if}}
6767
</div>
6868
{{#if this.readme}}
69-
<section local-class="crate-readme" aria-label="Readme" {{highlight-syntax selector="pre > code"}}>
70-
{{html-safe this.readme}}
69+
<section aria-label="Readme">
70+
<RenderedHtml @html={{this.readme}} />
7171
</section>
7272
{{else}}
7373
{{#if this.crate.description}}

0 commit comments

Comments
 (0)