Skip to content
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

Correct syntax highlighting #1413

Merged
merged 2 commits into from Feb 25, 2020

Conversation

adamchainz
Copy link
Sponsor Member

Use the explicit .. code-block reStructuredText directive throughout, and highlight all blocks with the correct pygments lexer. The :: syntax uses the default Python lexer which causes mishighlighting when it's not Python.

Also:

  • sneak in a change from pip install to python -m pip install as per my blog post today.
  • Fix 'WARNING: html_static_path entry '_static' does not exist' by commenting out '_static' entry

Use the explicit `.. code-block` reStructuredText directive throughout, and highlight all blocks with the correct pygments lexer. The `::` syntax uses the default Python lexer which causes mishighlighting when it's not Python.

Also:

* sneak in a change from `pip install` to `python -m pip install` as per my [blog post today](https://adamj.eu/tech/2020/02/25/use-python-m-pip-everywhere/).
* Fix 'WARNING: html_static_path entry '_static' does not exist' by commenting out '_static' entry
Copy link
Member

@carltongibson carltongibson left a comment

Choose a reason for hiding this comment

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

OK, overall looks good.

On Django we don't use code-block for the Python blocks.

Better go and read your blog post but... 😬

callable, that takes receive and send methods. It's usually written as a class::
callable, that takes receive and send methods. It's usually written as a class:

.. code-block:: python
Copy link
Member

Choose a reason for hiding this comment

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

Python is the default right?

Copy link
Sponsor Member Author

Choose a reason for hiding this comment

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

It is but I think using :: all over the place makes it hard for copy-pasters to find out about code-block and thus realize they can control the language highlighting. I prefer to be explicit

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, OK.

pip install -U channels
.. code-block:: sh

python -m pip install -U channels
Copy link
Member

Choose a reason for hiding this comment

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

I'm so Meh about this. pip install... has worked fine for years. 🙂

There was a matching one in contributing.txt. (I'm not suggesting you update that too. 🙂)

@carltongibson
Copy link
Member

@adamchainz OK, I'm Meh but I guess it's better advice for all and sundry. Can you update the pip install in contributing.txt too please? Ta.

@adamchainz
Copy link
Sponsor Member Author

Updated all pip installs

Yeah pip install has normally worked fine for me too, especially using virtualenvs, but I've helped enough people debug pip issues that I hit the point to change all my projects and write the post :)

Copy link
Member

@carltongibson carltongibson left a comment

Choose a reason for hiding this comment

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

Super. Thank you @adamchainz!

@carltongibson carltongibson merged commit 6d088a5 into django:master Feb 25, 2020
@adamchainz adamchainz deleted the docs_syntax_highlighting branch February 25, 2020 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants