Skip to content

feat: interlinks autolink #395

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

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft

feat: interlinks autolink #395

wants to merge 7 commits into from

Conversation

machow
Copy link
Owner

@machow machow commented Apr 15, 2025

This WIP PR automatically formats code as interlinks. Addresses #328

Essentially:

  • interlinks now supports a interlinks.autolinks = True setting, that turns inline Code directly to links.
  • This means you don't need to use [](`some_function`) syntax.
  • Currently...
    • No link shortening with ~. I don't think it would be confusing for this approach.
    • ~a.b.c when interlinks still uses ~a.b.c for the link text (use full link syntax for name shortening)
    • ~a.b.c when unmatched returns the original code ~a.b.c
  • Aliases
    • set interlinks.aliases to allow linking functions like quartodoc.Auto by just writing Auto
  • Opting out
    • use the .qd-no-link class to tell quartodoc not to try interlinking. E.g. `my_func`{.qd-no-link}

Alias example

interlinks:
  aliases:
    shiny: null          # refer to functions w/o writing shiny.
    quartodoc: qd   # use qd as alias. E.g. qd.Auto

thinking about

Basically we need to ensure:

  1. When a page author feels that a submodule's functions don't need their full import path, autolinks still work (e.g. via some alias mechanism etc..).
  2. When a page author feels like above, but using some module alias (e.g. pd.DataFrame), autolinks still work.
  3. The package being documented can also work like above (could be through same mechanism, or another).

@codecov-commenter
Copy link

codecov-commenter commented Apr 15, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.80%. Comparing base (b5a9518) to head (5f12af1).

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #395   +/-   ##
=======================================
  Coverage   88.80%   88.80%           
=======================================
  Files          40       40           
  Lines        3010     3010           
=======================================
  Hits         2673     2673           
  Misses        337      337           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@machow
Copy link
Owner Author

machow commented Apr 17, 2025

I'm having such a good time with this feature, I can't believe it took so long to come around to it!

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