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

docs: Upgrading Core links to Express links isn't always wanted #1315

Open
gadenbuie opened this issue Apr 12, 2024 · 3 comments
Open

docs: Upgrading Core links to Express links isn't always wanted #1315

gadenbuie opened this issue Apr 12, 2024 · 3 comments

Comments

@gadenbuie
Copy link
Collaborator

The quartodocs rendering process finds shiny.ui.___ links and upgrades them to shiny.express.ui.____ links

converted = converted.replace("shiny.ui.", "shiny.express.ui.")
# If this el happens to point to itself, it's probably intentionally
# pointing to Core (i.e., express context managers mention that they
# wrap Core functions), so don't change that.
# TODO: we want to be more aggressive about context managers always
# pointing to the Core docs?
if f"shiny.express.ui.{el.name}" in converted:
print(f"Changing Express link to Core for: {el.name}")
converted = converted.replace(
f"shiny.express.ui.{el.name}", f"shiny.ui.{el.name}"
)
converted = converted.replace("shiny.render.", "shiny.express.render.")

but this isn't always desirable, as in the case of :func:`~shiny.ui.page_auto` which only exists in shiny.ui. When the Express counterpart doesn't exist, the function is rendered as code without a link. See https://shiny.posit.co/py/api/express/express.ui.page_opts.html

image

@schloerke
Copy link
Collaborator

I'm ok if we white list exceptions until a bigger pattern emerges. The docs handling code doesn't need to be pretty

@cpsievert
Copy link
Collaborator

Maybe we could try importing converted using something like this, then informatively warn/error if it doesn't exist?

@gadenbuie
Copy link
Collaborator Author

...or just use the original link if the converted link doesn't exist.

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

No branches or pull requests

3 participants