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
[Docs]: Highlighting code snippets in .rst docs #11477
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! Here's some feedback from me:
- Some of these snippets are mislabeled. For example some
text
shippets are marked asbash
and somesolidity
ones are reallyyul
. - Should we use
bash
orshell
for shell snippets? - I'm not sure if we actually want to replace all the
::
bits withcode-block::
. I personally prefer thecode-block::
but::
is already pretty prevalent so we should first discuss this change. - Please squash your commits. Small commits are nice but simply putting every file in a separate commit does not really help reviewing. One way to split it that would actually be helpful would be if different highlighting languages were in different commits. But a single commit would be fine too since all of these modifications are closely related.
Also, @axic mentioned at some point that he already had some stashed work cleaning this up so this might conflict with his changes.
@cameel can you check that the script that extracts code snippets from the documentation still works with these changes? I assume it does, but please double-check. |
Sure. I'll check it when I get back to finish #11420. |
Thanks so much for your feedback.
Regarding Yul and Solididyt conflicting, it was just because of my lack of experience with Yul. I will go over the changes again to make sure of that.
For my I based my selection to the most used one, so before my changes
While Also, based on the following answer from StackOverflow on the
So I think we could follow with
Based on the rst documentation in this section:
So in order to highlight an example snippet of code, we need to use
Yes, I agree with you, I'm working on squashing commits now. |
4e8c165
to
219fddf
Compare
Commits squashing is done. |
|
The intention is to have the code highlighted in GitHub, to be more readable. |
@iskanderandrews Note that the docs are primarily meant to be viewed after being rendered by Sphinx (e.g. on https://docs.soliditylang.org), for which we do have Yul highlighting via a pygments plugin. Good highlighting on github is a good thing if possible but if there's a conflict between the too, I'd rather choose good highlighting in Sphinx over github. But I think it's a good argument for not relying on the default language in |
What do you mean by "highlighted in github"? Can you link to an example page on github? |
Sure, so this is an example
So that's what I mean by "highlighted in github" thus making it more readable. |
It does. In #11565 I now have tests that show that it works both with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@iskanderandrews Sorry, for not getting back to this earlier. I finally had time to finish my related PR (#11420) so now I'm also back to reviewing this.
So I think we could follow with .. code-block:: bash since it's the most used one already.
Fair enough. Let's keep bash
.
Apart from that there are 3 remaining issues:
- Some blocks are still mislabeled (mostly
solidity
instead ofyul
but alsosolidity
where it should bejavascript
and a few others). I pointed them all out in comments. - Some minor mistakes like
.. cod::e-block::
in one place. - I still think asm blocks should be marked as text. I mean, either way it's not a big deal but the generic asm highlighting is not very good for them in my opinion. Maybe we need another opinion here.
Once that's done please rebase on develop
and I think we can merge it :)
contract that called it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there actually a difference here? If it was a newline github would show that but it does not so I wonder what's going on here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah it's weird I didn't catch out what's changed here. I think in this script I just highlighted Solidity.
c430fdf
to
8aac82b
Compare
8aac82b
to
a8e9d7a
Compare
Alright, I think all has been resolved, I've rebased then squashed all commits. So, please review again, and mention me for any other changes or edits. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! It looks good now so I'm marking as approved.
I see that CI is not running on this PR, probably because it's an external one. @chriseth Do these need to be triggered manually now?
It should run, not sure why it does not - or maybe it just does not report its status? |
What did I change?
Thanks so much!