Replies: 3 comments 5 replies
-
I'd prefer the combo format. I think any reference to a specific line number has the potential to be problematic, I'd prefer an adjacent description of the section to be sought out, "In the If a small section of code needs to be referenced, wouldn't it be easier just to have a snippet on the page? |
Beta Was this translation helpful? Give feedback.
-
For format, I like the combo. Agreed with willihay regarding when to use code snippets vs. link to GH. Any code snippet that references source code should have a link or path to the file. For example, macro definitions or settings registry. It's incredibly useful to know where we can find these. We'll need to audit the docs for ambiguous filenames that don't have an explicit path or link to GH. I think code snippets should be short (~5 lines). If any longer, it'd be good to consider turning a code snippet into a link to source code. For long code snippets that don't reference the source code, such as for tutorials, they should highly consider turning it into source code we can link to instead. For example, by creating a usable code sample via a Gem. Links to code should always have contextual text, specifically the path name or file/directory name. It should never be written as "here" or "this"; for example, it shouldn't be "checkout the code here." |
Beta Was this translation helpful? Give feedback.
-
Thanks for the feedback, @FiniteStateGit and @chanmosq. I've put a recommendation into a new GitHub issue, based on our discussion: o3de/o3de.org#1926 |
Beta Was this translation helpful? Give feedback.
-
Thought it might be useful to preserve a discussion on this in the sig repo, for easy reference later.
I did not see anything under the Style guide inside the O3DE Contributor Guide regarding a standard format for references and/or links to O3DE source code. This has come up a number of times in the O3DE User Guide, and there is no consistent format as of yet.
Choices include:
Formats I've seen:
Simple file name reference:
Gems/StartingPointInput/Code/Source/InputLibrary.cpp
Pros: Shortest format. Relatively easy to open if you have the source on a PC. Could be used as the "text" part of a Markdown link.
Cons: Not everyone will have the source on their PC.
Simple link to a source file on GitHub, with or without line number/range:
Pros: Clickable link. Supports opening to a line number.
Cons: Since it's a clickable link, it's prone to breaking. The referenced code might move to a different line number, or be deleted.
GitHub permalink (i.e. specific commit) to a source file, with or without line number/range:
Pros: Clickable link. Always valid. Supports opening to a line number.
Cons: Longest format.
Others?
My preference is leaning towards this combo format:
Gems/StartingPointInput/Code/Source/InputLibrary.cpp
OR
Gems/StartingPointInput/Code/Source/InputLibrary.cpp
, Lines 118-123Beta Was this translation helpful? Give feedback.
All reactions