Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions app/components/rendered-html.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{{!--
This component renders raw HTML. Be very careful with this since it
can enable cross-site scripting attacks!
--}}
<div local-class="wrapper" ...attributes {{highlight-syntax selector="pre > code"}}>
{{html-safe @html}}
</div>
38 changes: 38 additions & 0 deletions app/components/rendered-html.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
.wrapper {
line-height: 1.5;
overflow-wrap: break-word;

> :first-child {
margin-top: 0;
}

> :last-child {
margin-bottom: 0;
}

img {
max-width: 100%;
}

pre {
overflow-x: auto;
}

p {
code {
background-color: #fff;
padding: 0 2px;
}
}

table {
border-collapse: collapse;
display: block;
overflow-x: auto;

th, td {
border: 1px solid #dfe2e5;
padding: 6px 13px;
}
}
}
34 changes: 4 additions & 30 deletions app/styles/crate/version.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ div.header {
.docs {
@media only screen and (min-width: 890px) {
flex: 7;
padding-right: 40px;
padding-right: 20px;
max-width: 640px;
}
}
Expand Down Expand Up @@ -194,35 +194,9 @@ div.header {
margin-bottom: 40px;
}

.crate-readme {
line-height: 1.5;
overflow-wrap: break-word;

img {
max-width: 100%;
}

pre {
overflow-x: auto;
}

p {
code {
background-color: #fff;
padding: 0 2px;
}
}

table {
border-collapse: collapse;
display: block;
overflow-x: auto;

th, td {
border: 1px solid #dfe2e5;
padding: 6px 13px;
}
}
.readme {
margin-top: 20px;
margin-bottom: 20px;
}

.crate-downloads {
Expand Down
4 changes: 2 additions & 2 deletions app/templates/crate/version.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@
{{/if}}
</div>
{{#if this.readme}}
<section local-class="crate-readme" aria-label="Readme" {{highlight-syntax selector="pre > code"}}>
{{html-safe this.readme}}
<section aria-label="Readme">
<RenderedHtml @html={{this.readme}} local-class="readme" />
</section>
{{else}}
{{#if this.crate.description}}
Expand Down