Skip to content
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

Add "Edit Documentation" link #1825

Open
wojtekmach opened this issue Nov 23, 2023 · 7 comments
Open

Add "Edit Documentation" link #1825

wojtekmach opened this issue Nov 23, 2023 · 7 comments

Comments

@wojtekmach
Copy link
Member

Extracted from #1818 (comment).

I think we have all the ingredients:

  1. GitHub code edit links may contain line numbers, notice the editor cursor is at line 3: https://github.com/elixir-lang/ex_doc/edit/main/lib/ex_doc/markdown.ex#L3

  2. Remix has a suitable icon: https://remixicon.com/icon/edit-line

Here is a mockup:

image

WDYT?

@wojtekmach
Copy link
Member Author

wojtekmach commented Nov 23, 2023

Oh, the link is a bit problematic. It seems it has to point to a branch and not a tag. This link https://github.com/elixir-lang/ex_doc/edit/v0.30.9/lib/ex_doc/markdown.ex#L3 404s.

There are thus two problems:

  1. We need to add a configuration for a branch, we shouldn't just hardcode "main".
  2. The edit link will get out of sync as the branch moves forward.

@garazdawi
Copy link
Contributor

Nice!

We have used main/master in https://erlang.org/doc for the target and so far I have not received any complaints. Whenever anyone edits the docs, they really should be editing the latest as things may already have been fixed.

You could also add a "View Documentation Source" in addition to "View Source" and get rid of that problem.

@halostatue
Copy link

What would happen for non-GitHub hosted projects (I don't have any personally, but it would be worthwhile to consider how this might be configured both for enablement (some people may not want those links on their documentation) and target.

@yasoob
Copy link

yasoob commented Feb 17, 2024

Any update on this? I often want to jump to the GitHub page of a project and currently I have to open a new tab and search for the project on Google and then get to the GitHub page. Having a direct edit link would be such a nice convenience and would do wonders in improving my workflow.

@josevalim
Copy link
Member

@yasoob the feature is already there for the source code. All you need to do is to click on the source icon and then the edit icon already on GitHub. It should take two clicks.

@josevalim
Copy link
Member

That said, I believe we can close this one. With Erlang moving to -doc attributes, docs and source are also collocated there, which reduces the need for a new link.

@josevalim josevalim closed this as not planned Won't fix, can't repro, duplicate, stale Feb 17, 2024
@garazdawi
Copy link
Contributor

In Erlang the docs are however not always colocated with the code, but can be referred via -doc {file, …}. So from our perspective a view/edit doc button would be a nice addition.

@josevalim josevalim reopened this Feb 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

5 participants