[DOCS] New guidelines for referencing and linking to source code #1926
Labels
kind/contributing
priority/major
Major priority. Work that should be handled after all blocking and critical work is done.
triage/accepted
Indicates an issue or PR is ready to be actively worked on.
Describe the issue briefly
There's nothing in the Contributor Style Guide as of yet regarding a standard format for references and links to O3DE source code. Contributors have used a variety of formats in the O3DE User Guide. To promote consistency, we should provide some guidelines in the Contributor Guide.
Which page(s) / section(s) are affected?
Links style
In this section on Formatting, various styles for links are presented. I recommend that we divide this into Docs links - which would contain the styles currently mentioned - and Source code links. Under source code links, I recommend the following guidelines:
New guideline on source code links
When linking to specific files or line numbers in source code, use permalinks whenever possible.
File link example:
Result:
Gems/StartingPointInput/Code/Source/StartingPointInputGem.cpp
To link to a specific section of the source file, such as a function or a line of code, include line numbers in the URL. It's preferable to describe the section using words instead of line numbers because line numbers can easily change. While a permalink will always be valid, a line number range in the link label can be misleading if those lines have changed in more recent versions of the source code.
File section link example:
Result:
Reflect function calls in Gems/StartingPointInput/Code/Source/StartingPointInputGem.cpp
To obtain permalinks for a file in a GitHub repo, navigate to the Code tab and open the file, then choose Copy permalink from the ... menu:
To obtain permalinks for specific lines of code in a file in a GitHub repo:
Alternatively, you can just manually add the line number range to the end of the file's permalink URL, using the format:
#Lnnn-Lnnn
, wherennn
represents a line number.The text was updated successfully, but these errors were encountered: