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

FR: use more clickable hyperlinks in error messages #2329

Closed
olivroy opened this issue Aug 7, 2023 · 3 comments · Fixed by #2439
Closed

FR: use more clickable hyperlinks in error messages #2329

olivroy opened this issue Aug 7, 2023 · 3 comments · Fixed by #2439
Labels
feature a feature request or enhancement

Comments

@olivroy
Copy link
Collaborator

olivroy commented Aug 7, 2023

Sorry if this issue is not as focused.

Here is a workflow I sometimes use when working on packages to preview its reference index without rendering everything.

# on  a package without an unititalized `docs` directory.
build_reference_index()
Error in `data_deps()`:
! Run pkgdown::init_site() first.

I was wondering if pkgdown::init_site() could be a runnable hyperlink?

# I do as instructed.
pkgdown::init_site()
Error: 'path/to/pkg/docs' is non-empty and not built by pkgdown

Unfortunately, there is an error.

I think that with my first call, the docs directory is initiated, but is corrupt..
In this case, maybe suggest users to use pkgdown::clean_site() then pkgdown::init_site() in the error message? I may have gotten that part wrong.

# running without error
pkgdown::clean_site()
pkgdown::init_site()
#> Copying '../../../AppData/Local/Programs/R/R-4.2.3/library/pkgdown/BS5/assets/link.svg' to 'link.svg'
#> Copying '../../../AppData/Local/Programs/R/R-4.2.3/library/pkgdown/BS5/assets/pkgdown.js' to 'pkgdown.js'

Then build_reference_index() works.

build_reference_index()
#> Writing 'reference/index.html'

I can click on the result after all that.

Maybe my workflow is incorrect, so looking for suggestions. However, if it is something that you think is sensible, could the process be simplified a little, so that possibly build_reference_index() work on the first try, or the roadmap to success is a little less bumpy (i.e. adding runnable hyperlinks in error messages that will not error )

Thanks!

Edit: some digging

# with empty state
pkgdown:::is_non_pkgdown_site("docs")
#> FALSE
build_reference_index()
Error in `data_deps()`:
! Run pkgdown::init_site() first.
pkgdown:::is_non_pkgdown_site("docs")
#> TRUE
@olivroy olivroy changed the title FR: use more clickable hyperlinks. FR: use more clickable hyperlinks in error messages Aug 7, 2023
@hadley hadley added the feature a feature request or enhancement label Oct 30, 2023
@hadley
Copy link
Member

hadley commented Oct 30, 2023

Nice idea. I hit this myself all the time too, so I'll definitely take a look at when I'm next working on pkgdown.

@hadley
Copy link
Member

hadley commented Apr 12, 2024

@olivroy have we resolved this issue?

@olivroy
Copy link
Collaborator Author

olivroy commented Apr 12, 2024

Opened #2439 to solve this!

hadley pushed a commit that referenced this issue Apr 15, 2024
SebKrantz pushed a commit to SebKrantz/pkgdown that referenced this issue Jun 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants