When you link a Github file with an anchor, the preview which Discourse renders is of the top of the file rather than from the anchor on.
See for instance:
https://github.com/discourse/discourse/blob/main/README.md#development
This should preview show the development section, not the top of the readme.
(Not sure whether this is actually a bug.)
Discuss this on our forum.