Skip to content

Add source_url so ex_doc can generate links to source code #14

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

Merged
merged 1 commit into from
Apr 14, 2025

Conversation

axelson
Copy link
Contributor

@axelson axelson commented Apr 4, 2025

See docs:
https://hexdocs.pm/ex_doc/0.37.3/Mix.Tasks.Docs.html#module-configuration

Also minor updates to ex_doc and earmark_parser

Right now the PostHog docs don't have a link to source code:
Screenshot 2025-04-03 at 15 23 06@2x

Many libraries on hexdocs do have links and they look like (https://hexdocs.pm/phoenix/Phoenix.Socket.html#assign/3):
Screenshot 2025-04-03 at 15 18 08@2x

Adding source_url and push up a git tag for each release will fix this.

Note: it is also possible to publish an updated version of the docs without releasing a new version of the package.

@axelson axelson requested a review from rafaeelaudibert as a code owner April 4, 2025 01:24
@rafaeelaudibert
Copy link
Member

Hey @axelson!

Adding source_url and push up a git tag for each release will fix this.

Where did you find the fact that we need to push up a git tag for each release? We're not doing that right now, and Im happy to change CI to make that work, but it'd be good to see documentation explaining how that works (the link you linked doesn't say that anywhere, but neither does it say what source_url does to be honest)

@rafaeelaudibert
Copy link
Member

Once we merge this, I'll also merge a follow-up PR including some more changes to make our hexdocs docs a little bit nicer (logo, favicon, banner, etc)

@axelson
Copy link
Contributor Author

axelson commented Apr 6, 2025

Where did you find the fact that we need to push up a git tag for each release? We're not doing that right now, and Im happy to change CI to make that work, but it'd be good to see documentation explaining how that works (the link you linked doesn't say that anywhere, but neither does it say what source_url does to be honest)

Hi! 👋

I'm not sure where I initially learned it. It was probably because I encountered a library that set :source_url but did not push git tags so the generated source code links resulted in 404's.

I looked around for official documentation of this requirement but I was not able to find any so I have created a PR to add it at: elixir-lang/ex_doc#2109

@rafaeelaudibert
Copy link
Member

Hey!

Thanks for that! I'll wait for confirmation from José before we merge this. If he's correct - and I doubt Valim would be wrong there - we'll also need to update our script to include the ref config he's mentioning.

@axelson
Copy link
Contributor Author

axelson commented Apr 12, 2025

The PR isn't merged yet (although I did push up improved wording today) but the info has been confirmed so I think this change can be considered unblocked.

@rafaeelaudibert
Copy link
Member

I see José just merged it. I'll merge this PR, but it wont outright work because we're missing source_ref AND tagging the version. Im working on a PR to add that. Once we have both, we'll have links in our docs!

Thanks for your effort here @axelson!

@rafaeelaudibert rafaeelaudibert merged commit d8bdae6 into PostHog:master Apr 14, 2025
5 checks passed
rafaeelaudibert added a commit that referenced this pull request Apr 14, 2025
Besides including the `source_url` added in #14, let's also add some images and include `source_ref` - per elixir-lang/ex_doc#2109
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants