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

Better heuristics for finding badges #670

Closed
gaborcsardi opened this issue May 16, 2018 · 5 comments

Comments

@gaborcsardi
Copy link
Member

commented May 16, 2018

Would be nice. I like to put a title and/or a logo at the beginning of the README and then pkgdown does not find the badges. E.g.:

# processx

> Execute and Control System Processes

[![lifecycle](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://tidyverse.org/lifecycle/#maturing)
...
<h1 align="center">
    <br>
    <br>
    <img width="400" src="./inst/logo.png" alt="crayon">
    <br>
    <br>
    <br>
</h1>

> Stylish terminal output in R

[![Project Status: Active - The project has reached a stable, usable state and is being actively developed.](http://www.repostatus.org/badges/latest/active.svg)](http://www.repostatus.org/#active)
...
@gaborcsardi

This comment has been minimized.

Copy link
Member Author

commented May 16, 2018

Or maybe allow marking the badges, e.g. putting them in a div:

<div id="badges">
  ...  
</div>
@hadley

This comment has been minimized.

Copy link
Member

commented Jun 1, 2018

This approach doesn't work with gfm, so we'll need to try again in the next release.

@hadley hadley reopened this Jun 1, 2018

@maelle

This comment has been minimized.

Copy link
Contributor

commented Mar 19, 2019

I've had the issue again, on a package of @gaborcsardi's of course. 😹

These days, if created with usethis a README has <!-- badges: start --> comments, that are in the html too. On the README I'm looking at I can extract the right paragraph with xml2::xml_find_all(html, ".//*/comment()/following-sibling::p[1]") but this might not be specific enough (it could be any paragraph after a comment) and I'm not good enough at XPath to find a good solution quickly. If no one else is, I can dig further.

@maelle

This comment has been minimized.

Copy link
Contributor

commented Apr 11, 2019

Other example of a package where the badges paragraph isn't the first one
https://github.com/ropensci/qualtRics/blob/master/README.Rmd
https://ropensci.github.io/qualtRics/

I can work on a PR + better XPath query (and with a mention somewhere in the docs of build_home() of the tip to use the <!-- badges: start --> stuff) if that's of interest.

@hadley

This comment has been minimized.

Copy link
Member

commented Apr 11, 2019

@maelle that would be great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.