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

Improve and clarify linking functions #26

Open
k5cents opened this issue Jan 29, 2020 · 0 comments
Open

Improve and clarify linking functions #26

k5cents opened this issue Jan 29, 2020 · 0 comments
Labels
help wanted idea New feature or request

Comments

@k5cents
Copy link
Owner

k5cents commented Jan 29, 2020

Right now, there is a mishmash of linking arguments. I like the ability to create very simple named links.

gluedown::md_link(CRAN = "https://cran.r-project.org/")

CRAN

However, this kind of conflict with the original thesis of the package: vectors to markdown. If the user has programatically created two long vectors of text and links, they should be able to coerce them into a new vector of markdown links. This is currently still possible with the .name argument, but it feels sloppy.

Ideally you would be able to use text = url with two vectors, but this kind of naming with dots doesn't work how I'd like.

s <- 1:3
name <- state.name[s]
abb <- glue::glue("https://{state.abb[s]}.gov")
gluedown::md_order(gluedown::md_link(name = abb))
  1. name1
  2. name2
  3. name3

Ideally, it would work more like names(link) <- text.

names(abb) <- name
gluedown::md_order(glue::glue("[{names(abb)}]({unname(abb)})"))
  1. Alabama
  2. Alaska
  3. Arizona

This same confusion also needs to be cleared up for link labels and references. Also, perhaps we need a single function to do both: print labels and print invisible references.

gluedown::md_bullet(gluedown::md_label(state.name[s], s))
# * [Alabama][1]
# * [Alaska][2]
# * [Arizona][3]
gluedown::md_reference(label = s, url = glue::glue("https://{state.abb[s]}.gov"))
# [1]: https://AL.gov
# [2]: https://AK.gov
# [3]: https://AZ.gov
@k5cents k5cents added help wanted idea New feature or request labels Feb 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted idea New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant