InstituteforDiseaseModeling / covasim

COVID-19 Agent-based Simulator (Covasim): a model for exploring coronavirus dynamics and interventions
https://covasim.org
MIT License
250 stars 223 forks source link

Fix "Edit on GitHub" link #287

Closed lgeorge-idm closed 4 years ago

lgeorge-idm commented 4 years ago

Fixed the "Edit on GitHub" link when building on RTD.

Working example: https://docs.idmod.org/projects/covasim/en/rtd_fix-github-edit-link/

JSchripsema-IDM commented 4 years ago

@cliffckerr I think it's a better user experience to point to the RST files, which at least provide a pointer to the correct README that is the source for that HTML topic. Especially as the number of docs files grows, I think going to just the top of the code repo would be frustrating and require digging to find the correct file to edit.

cliffckerr commented 4 years ago

@JSchripsema-IDM I agree that would be preferable, but currently it seems to just point to the index file rather than the actual source file, e.g.: image If it could point to the actual source, that would be great, but I'm not sure if it's possible.

JSchripsema-IDM commented 4 years ago

@cliffckerr When I test it, the "Edit on GitHub" link takes me to the correct RST file, which shows that "include:: ../path/to/README" directive. So it's an extra click to get to the correct README file, but at least it tells you where to go. I don't think there's a way to go directly to the README file itself, since the RST file IS what Sphinx is using as the docs source. It copies and pulls in the content of the README file at build time, but the RST file is the source file that Sphinx sees.

cliffckerr commented 4 years ago

@JSchripsema-IDM Ah, OK. For me there's no way to "click" on it, I have to manually edit the URL to go to the right file. But if this is desired behavior, then it's fine with me!