Skip to content

Refactor SCSS and HTML templates for improved code snippet presentation #1929

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions djangoproject/scss/_pygments.scss
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ html[data-theme="light"],

// For Django 2.0 docs and older.
.snippet-filename {
background: var(--secondary-accent);
color: var(--code-fg);
// background: var(--secondary-accent);
// color: var(--code-fg);
Comment on lines +45 to +46
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned in the comment above, these styles are used for old versions of the documentation, see for example https://docs.djangoproject.com/en/1.11/intro/tutorial01/#write-your-first-view

Commenting this out will break the styling of those older documents, so this approach doesn't work.

@include monospace;
font-size: 1em;
padding: 5px 20px;
Expand Down
21 changes: 17 additions & 4 deletions djangoproject/templates/releases/download.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,17 @@ <h2>Option {% cycle '1' '2' '3' as options %}: Get the latest official version</
{% release_notes current.version show_version=True %}, then install it with
<a href="https://pip.pypa.io/en/latest/">pip</a>:</p>
<p>Linux / macOS:</p>
<pre class="literal-block"><code>python -m pip install Django=={{ current.version }}</code></pre>


<div class="snippet">
<pre class="literal-block snippet-filename highlight"><code>python -m pip install Django=={{ current.version }}</code></pre>
</div>


<p>Windows:</p>
<pre class="literal-block"><code>py -m pip install Django=={{ current.version }}</code></pre>
<div class="snippet">
<pre class="literal-block snippet-filename highlight"><code>py -m pip install Django=={{ current.version }}</code></pre>
</div>

{% if preview %}
{% with preview.version|slice:":3" as major_version %}
Expand All @@ -46,13 +54,18 @@ <h2>Option {% cycle options %}: Get the {{ preview.get_status_display }} for {{
{{ major_version }} release. Please read the
{% release_notes preview.version show_version=True %} before using this package.
<p>Install the {{ preview.get_status_display }} with <a href="https://pip.pypa.io/">pip</a>:</p>
<pre class="literal-block"><code>pip install --pre django</code></pre>
<div class="snippet">
<pre class="literal-block snippet-filename highlight"><code>pip install --pre django</code></pre>
</div>
{% endwith %}
{% endif %}

<h2>Option {% cycle options %}: Get the latest development version</h2>
<p>The latest and greatest Django version is the one that’s in our Git repository (our revision-control system). This is only for experienced users who want to try incoming changes and help identify bugs before an official release. Get it using this shell command, which requires <a href="https://git-scm.com/">Git</a>:</p>
<p class="literal-block"><code>git clone https://github.com/django/django.git</code></p>
<div class="snippet">
<p class="literal-block snippet-filename highlight"><code>git clone https://github.com/django/django.git</code></p>
</div>

<p>You can also download <a href="https://github.com/django/django/archive/main.tar.gz">
a gzipped tarball</a> of the development version. This archive is updated
every time we commit code.</p>
Expand Down