pharmaverse / blog

Blogging on the latest, greatest and most spectacular stuff happening around the pharmaverse
https://pharmaverse.github.io/blog/
Apache License 2.0
21 stars 8 forks source link

[WIP] quarto shortcode `pkg` #121

Closed romainfrancois closed 6 months ago

romainfrancois commented 6 months ago

... actually we probably be better off with an R-based solution, leveraging:

downlit::href_package("admiral")
#> [1] "https://pharmaverse.github.io/admiral/"
downlit::href_package("teal")
#> [1] "https://insightsengineering.github.io/teal/"

downlit::href_topic("derive_extreme_event", "admiral")
#> [1] "https://pharmaverse.github.io/admiral/reference/derive_extreme_event.html"
downlit::href_topic("init", "teal")
#> Registered S3 method overwritten by 'teal':
#>   method        from      
#>   c.teal_slices teal.slice
#> [1] "https://insightsengineering.github.io/teal/latest-tag/reference/init.html"

Created on 2024-02-23 with reprex v2.1.0

bms63 commented 6 months ago

... actually we probably be better off with an R-based solution, leveraging:

downlit::href_package("admiral")
#> [1] "https://pharmaverse.github.io/admiral/"
downlit::href_package("teal")
#> [1] "https://insightsengineering.github.io/teal/"

downlit::href_topic("derive_extreme_event", "admiral")
#> [1] "https://pharmaverse.github.io/admiral/reference/derive_extreme_event.html"
downlit::href_topic("init", "teal")
#> Registered S3 method overwritten by 'teal':
#>   method        from      
#>   c.teal_slices teal.slice
#> [1] "https://insightsengineering.github.io/teal/latest-tag/reference/init.html"

Created on 2024-02-23 with reprex v2.1.0

I like this!! One less repo/pkg to maintain!!

romainfrancois commented 6 months ago

Now supporting something like:

`r pkg("admiral")`
`r fun("admiral::derive_vars_extreme_event")`

pkg and fun (or whatever they end up being called) can be hosted in a general purpose package. Is this something e.g. quarto should have ? cc @cderv

romainfrancois commented 6 months ago

I'll send another PR based on http://link.tada.science/index.html

cderv commented 6 months ago

Nice idea ! I like your new link package !

This will work well with R inlines it seems. Do you think having this in quarto can help more or improve the user experience ?

romainfrancois commented 6 months ago

Probably. We could imagine it set as an option instead of having to call link::auto(), maybe it makes sense higher up, markdown ? I guess this would also mean thinking about equivalent auto linking in 🐍.

Anyway, contributing to quarto seems out of my reach, I'm happy to be tagged and review something though.

bms63 commented 6 months ago

@cderv is there ability/shortcode to easily link blog posts from within other blog posts? https://github.com/pharmaverse/blog/pull/122#issuecomment-1965276875

cderv commented 6 months ago

@bms63 there is no such feature as link package as shortcode.

By other blog post, do you mean in the same blog ?

You should be to use internal links to other .qmd document in your project. But in your comment I see

I saw that this post had link to an older post but itis hardcoded.

So what exactly do you expect as feature ? Link checker ? What would the shortcode do exactly ?

Sorry I am maybe missing something obvious

bms63 commented 6 months ago

Hey @cderv I guess I did not realize you could link to internal files like you do with pkgdown sites! Thanks for the tip!!

cderv commented 6 months ago

We mention this here: https://quarto.org/docs/websites/index.html#linking

See [this doc](relative/to/current.qmd)

You can even link from root project easily (still undocumented)

See [this doc](/from/project/root/file.qmd)

Quarto will transform links to HTML file using correct path.

bms63 commented 6 months ago

We mention this here: https://quarto.org/docs/websites/index.html#linking

See [this doc](relative/to/current.qmd)

You can even link from root project easily (still undocumented)

See [this doc](/from/project/root/file.qmd)

Quarto will transform links to HTML file using correct path.

ohh i feel kind of silly now... thanks @cderv !!

image