Repository navigation
Fix code formatting of some examples - #7730
Conversation
Co-authored-by: Ross Barnowski <[email protected]>
| G = nx.soft_random_geometric_graph(50, 0.2) | ||
| >>> G = nx.soft_random_geometric_graph(50, 0.2) | ||
|
|
||
| Custom Graph: |
There was a problem hiding this comment.
Hi, just came accross this PR. If I understand correctly, the example for Custom Graph is in the Notes section, a few lines below in the source code.
However, in the doc, the Notes section appears above the Examples section, which makes this example confusing. I think it would be perfect if both examples for Default Graph and Custom Graph could be placed in the same Examples section.
There was a problem hiding this comment.
Good catch. It is weird that Examples is at the bottom... below even References. I never gave this thought, but Examples does come at the end with numpydoc style: https://numpydoc.readthedocs.io/en/latest/format.html#examples
There was a problem hiding this comment.
I am (as usual) confused. It looks to me like both the Default Graph example and the Custom Graph example appear together in an Examples section after the References section. I see that the Notes section is above both Refernece and Examples. That is, the section order changes between the doc_string in the code and the HTML generated by sphinx using the theme. But both examples are in the same examples section.
Is that different from what you are seeing @yuanx749 ?
There was a problem hiding this comment.
@dschult What I feel confusing is that there is only instruction ('Create a soft random...') under Custom Graph, but no code example. (Default Graph has example code.)
My understanding may be wrong. The code snippet in the Notes section could be used as an example for custom graph, but it appears above Examples section due to the section order changes after sphinx rendering.
There was a problem hiding this comment.
Ahhh.... I understand what you are saying now. :)
Thank you!
There was a problem hiding this comment.
There was a problem hiding this comment.
@rossbar Yes, I think it would be better to update the examples with a separate PR. (I may open one in a couple of days if I have time).
| G = nx.thresholded_random_geometric_graph(50, 0.2, 0.1) | ||
| >>> G = nx.thresholded_random_geometric_graph(50, 0.2, 0.1) | ||
|
|
||
| Custom Graph: |
Some
Examplessections in the docs aren't being displayed correctly. These are the ones I was able to catch at a quick glance: