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

Restore warning on missing references and .html link (for .md) #1798

Merged
merged 3 commits into from
Oct 30, 2023
Merged

Restore warning on missing references and .html link (for .md) #1798

merged 3 commits into from
Oct 30, 2023

Conversation

paulo-ferraz-oliveira
Copy link
Contributor

While 9579ce8 (from #1617) added features to ex_doc, it also stopped using hardcoded language Elixir, which seems to have had the unintended consequence of removing other features, like:

  • the ability to report on invalid links (e.g. warning: documentation references file "examples" but it does not exist), and
  • auto-linking from .md to .html (links aren't "transformed"), e.g. as per using rebar3_ex_doc.

I found the commit by git bisect'ing, and it helped me understand where the origin of the issue was.

This pr is just an initial step as I understand you might not want the Erlang handler calling the Elixir handler, but:

  1. I don't know where to put the "generic" code,
  2. I don't know if it's acceptable to simply copy the code over.

I did copy the tests over from the Elixir counterpart, though, as that seemed to make sense (same requirements, I guess).

defp custom_link(attrs, config) do
def custom_link(attrs, config) do
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the function I mention in the description. Where to put it, and the code it depends on?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can put it in the ExDoc.Autolink module :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, thanks. I'll move it, and the code it depends on, to that one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1. identify function to move over: "custom_link/2"
2. copy-paste, from elixir.ex, then remove it there
3. save, format and mix test
4. got warnings, solved those, identified new function
5. rinse and repeat from 2-4 until no more warnings

Finally, "Autolink." was removed from autolink.ex
erlang.ex was adapted to use the newly exposed function

Tests are as-were (no failures, locally)
There are no compilation warnings, locally
@wojtekmach wojtekmach merged commit 5eee045 into elixir-lang:main Oct 30, 2023
4 checks passed
@wojtekmach
Copy link
Member

Thank you!

@paulo-ferraz-oliveira paulo-ferraz-oliveira deleted the fix/md-links-and-missing-link-warnings branch October 30, 2023 20:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants