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

Use permalink instead of copy&paste the source code in documents #2444

Closed
fujitatomoya opened this issue Apr 28, 2022 · 5 comments
Closed

Use permalink instead of copy&paste the source code in documents #2444

fujitatomoya opened this issue Apr 28, 2022 · 5 comments
Labels
help wanted Extra attention is needed question Further information is requested

Comments

@fujitatomoya
Copy link
Collaborator

It would be really nice and good for maintenance if we can link the source code as permalink instead of doing copy&paste the related source code in this repository.

example: https://github.com/ros2/ros2_documentation/blob/rolling/source/Tutorials/Intra-Process-Communication.rst code-block

@fujitatomoya fujitatomoya added help wanted Extra attention is needed good first issue Good for newcomers question Further information is requested and removed good first issue Good for newcomers labels Apr 28, 2022
@fujitatomoya
Copy link
Collaborator Author

question came up on #2441 (review)

@kurshakuz
Copy link
Collaborator

kurshakuz commented May 2, 2022

I agree that it could simplify maintenance a lot! There are already a couple of examples that do use the source code directly in the rst files like:

  1. https://github.com/ros2/ros2_documentation/rolling/source/Tutorials/Actions/Writing-a-Cpp-Action-Server-Client.rst
  2. https://github.com/ros2/ros2_documentation/blob/rolling/source/Tutorials/Actions/Writing-a-Py-Action-Server-Client.rst

Look for .. literalinclude:: directive.

Unfortunately, those examples require to host code snippets locally. I am not sure if it is possible to directly fetch code samples from other repositories. So I don't think it is a feasible solution. Does anyone have better ideas?

@gavanderhoorn
Copy link
Contributor

Would depending on something like sphinxext-remoteliteralinclude be acceptable for this (Github repository: wpilibsuite/sphinxext-remoteliteralinclude)?

It seems to address the exact issue reported here: be able to retrieve code from a remote location, instead of duplicating it next to the .rst using literalinclude.

@gavanderhoorn
Copy link
Contributor

Put something together using remoteliteralinclude.

See #2828.

@fujitatomoya
Copy link
Collaborator Author

I will go ahead to close this issue, it is gonna be tough to keep the consumable and stable documentation instead of permlink. feel free to reopen this, if someone gets interested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed question Further information is requested
Projects
None yet
3 participants