Skip to content

Improve styling of the policy pages #7496

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Nov 10, 2023
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
5 changes: 2 additions & 3 deletions app/components/rendered-html.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
This component renders raw HTML. Be very careful with this since it
can enable cross-site scripting attacks!
--}}
<div
local-class="wrapper"
<TextContent
...attributes
{{highlight-syntax selector="pre > code:not(.language-mermaid)"}}
{{render-mermaids}}
>
{{html-safe @html}}
</div>
</TextContent>
3 changes: 3 additions & 0 deletions app/components/text-content.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div local-class="wrapper {{if @boxed "boxed"}}" ...attributes>
{{yield}}
</div>
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
.boxed {
padding: var(--space-m);
background-color: white;
margin-bottom: var(--space-s);
border-radius: 5px;
}

.wrapper {
line-height: 1.5;
overflow-wrap: break-word;
Expand Down
178 changes: 90 additions & 88 deletions app/templates/data-access.hbs
Original file line number Diff line number Diff line change
@@ -1,90 +1,92 @@
<PageHeader @title="Accessing crates.io data" />

<p>
crates.io provides several ways of accessing crate data and metadata,
depending on what you specifically need. Please try them in the order below.
</p>

<h2 id="crate-index"><a href="#crate-index">Crate index</a></h2>

<p>
The crates.io sparse index is available at
<a href="https://index.crates.io">index.crates.io</a>, which adheres to the
<a href="https://doc.rust-lang.org/cargo/reference/registry-index.html">Cargo index format</a>.
The sparse index provides an extremely efficient way of accessing metadata on
a single or small number of crates.
</p>

<p>
Each index file provides newline delimited JSON metadata on all published
versions of the crate, organised into
<a href="https://doc.rust-lang.org/cargo/reference/registry-index.html#index-files">index files</a>.
For example, information on the <code>base64</code> crate can be found at
<a href="https://index.crates.io/ba/se/base64">https://index.crates.io/ba/se/base64</a>.
</p>

<p>
No rate limits are required to use data from the sparse crate index.
</p>

<h3 id="legacy-git-index"><a href="#legacy-git-index">Legacy Git crate index</a></h3>

<p>
Older versions of Cargo use the crate index provided in the
<a href="https://github.com/rust-lang/crates.io-index"><code>rust-lang/crates.io-index</code> repository on GitHub</a>.
This remains available for use, and may be a more efficient way of accessing
crate metadata for projects that require most or all crates to be included
than the sparse index.
</p>

<p>
As the Git index is hosted on GitHub, GitHub's
<a href="https://docs.github.com/en/site-policy/acceptable-use-policies/github-acceptable-use-policies">Acceptable Use Policies</a>
apply.
</p>

<h2 id="database-dumps"><a href="#database-dumps">Database dumps</a></h2>

<p>
crates.io database dumps contain all information available through the
crates.io API in a single download. They are updated every 24 hours.
</p>

<p>
The latest dump is available at the address
<a href="https://static.crates.io/db-dump.tar.gz">https://static.crates.io/db-dump.tar.gz</a>.
Information on using the dump is contained in the tarball. You can find the changelog for database dumps in
<a href="https://github.com/rust-lang/crates.io/issues/3617">GitHub issue #3617</a>.
</p>

<h2 id="api"><a href="#api">crates.io API</a></h2>

<p>
crates.io provides an API that is a superset of the functionality required by
the
<a href="https://doc.rust-lang.org/cargo/reference/registry-web-api.html">Cargo Web API</a>.
Should you be unable to use one of the previous options, you are welcome to
use the crates.io API provided you abide by the same limits as
<LinkTo @route="policies">the crawling policy</LinkTo>. In summary:
</p>

<ol>
<li>A maximum of 1 request per second, and</li>
<li>
A <code>user-agent</code> header that identifies your application. We
strongly suggest providing a way for us to contact you (whether through a
repository, or an e-mail address, or whatever is appropriate) so that we can
reach out to work with you should there be issues.
</li>
</ol>

<h2 id="questions"><a href="#questions">Questions</a></h2>

<p>
If none of the above options suit your needs, please contact the crates.io
team either at <a href="mailto:[email protected]">[email protected]</a>, or by
starting
<a href="https://github.com/rust-lang/crates.io/discussions">a discussion on GitHub</a>,
and we'll be happy to discuss solutions that might exist outside of the above
guidelines.
</p>
<TextContent @boxed={{true}}>
<p>
crates.io provides several ways of accessing crate data and metadata,
depending on what you specifically need. Please try them in the order below.
</p>

<h2 id="crate-index"><a href="#crate-index">Crate index</a></h2>

<p>
The crates.io sparse index is available at
<a href="https://index.crates.io">index.crates.io</a>, which adheres to the
<a href="https://doc.rust-lang.org/cargo/reference/registry-index.html">Cargo index format</a>.
The sparse index provides an extremely efficient way of accessing metadata on
a single or small number of crates.
</p>

<p>
Each index file provides newline delimited JSON metadata on all published
versions of the crate, organised into
<a href="https://doc.rust-lang.org/cargo/reference/registry-index.html#index-files">index files</a>.
For example, information on the <code>base64</code> crate can be found at
<a href="https://index.crates.io/ba/se/base64">https://index.crates.io/ba/se/base64</a>.
</p>

<p>
No rate limits are required to use data from the sparse crate index.
</p>

<h3 id="legacy-git-index"><a href="#legacy-git-index">Legacy Git crate index</a></h3>

<p>
Older versions of Cargo use the crate index provided in the
<a href="https://github.com/rust-lang/crates.io-index"><code>rust-lang/crates.io-index</code> repository on GitHub</a>.
This remains available for use, and may be a more efficient way of accessing
crate metadata for projects that require most or all crates to be included
than the sparse index.
</p>

<p>
As the Git index is hosted on GitHub, GitHub's
<a href="https://docs.github.com/en/site-policy/acceptable-use-policies/github-acceptable-use-policies">Acceptable Use Policies</a>
apply.
</p>

<h2 id="database-dumps"><a href="#database-dumps">Database dumps</a></h2>

<p>
crates.io database dumps contain all information available through the
crates.io API in a single download. They are updated every 24 hours.
</p>

<p>
The latest dump is available at the address
<a href="https://static.crates.io/db-dump.tar.gz">https://static.crates.io/db-dump.tar.gz</a>.
Information on using the dump is contained in the tarball. You can find the changelog for database dumps in
<a href="https://github.com/rust-lang/crates.io/issues/3617">GitHub issue #3617</a>.
</p>

<h2 id="api"><a href="#api">crates.io API</a></h2>

<p>
crates.io provides an API that is a superset of the functionality required by
the
<a href="https://doc.rust-lang.org/cargo/reference/registry-web-api.html">Cargo Web API</a>.
Should you be unable to use one of the previous options, you are welcome to
use the crates.io API provided you abide by the same limits as
<LinkTo @route="policies">the crawling policy</LinkTo>. In summary:
</p>

<ol>
<li>A maximum of 1 request per second, and</li>
<li>
A <code>user-agent</code> header that identifies your application. We
strongly suggest providing a way for us to contact you (whether through a
repository, or an e-mail address, or whatever is appropriate) so that we can
reach out to work with you should there be issues.
</li>
</ol>

<h2 id="questions"><a href="#questions">Questions</a></h2>

<p>
If none of the above options suit your needs, please contact the crates.io
team either at <a href="mailto:[email protected]">[email protected]</a>, or by
starting
<a href="https://github.com/rust-lang/crates.io/discussions">a discussion on GitHub</a>,
and we'll be happy to discuss solutions that might exist outside of the above
guidelines.
</p>
</TextContent>
Loading