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

get_section_level() fails on unnumbered sections #1654

Closed
gustavdelius opened this issue Apr 30, 2021 · 8 comments · Fixed by #1657
Closed

get_section_level() fails on unnumbered sections #1654

gustavdelius opened this issue Apr 30, 2021 · 8 comments · Fixed by #1657
Labels
bug an unexpected problem or unintended behavior

Comments

@gustavdelius
Copy link
Contributor

The current implementation of get_section_level() fails on unnumbered sections created in RMarkdown with

# This section is unnumbered {-}

(see https://bookdown.org/yihui/rmarkdown-cookbook/unnumbered-sections.html). This leads to class="section level1 unnumbered which the regular expression in get_section_level() can not deal with.

@hadley
Copy link
Member

hadley commented Apr 30, 2021

What problem does that cause?

@gustavdelius
Copy link
Contributor Author

It makes build_search() throw an error on any site that has Rmarkdown documents with unnumbered sections.

@hadley
Copy link
Member

hadley commented Apr 30, 2021

I don't think that can be true because I use unnumbered sections in my books, and search works for me.

@gustavdelius
Copy link
Contributor Author

O.k., so perhaps not every site. But on an ordinary pkgdown site created for an R package. Try for example making a heading in one of the pkgdown vignettes unnumbered, then run pkgdown::build_articles() and then pkgdown::build_search() and you will see the error.

@hadley
Copy link
Member

hadley commented Apr 30, 2021

Oh this is pkgdown, not bookdown. Sorry, I got confused!

@maelle maelle added the bug an unexpected problem or unintended behavior label May 1, 2021
@maelle
Copy link
Collaborator

maelle commented May 1, 2021

@gustavdelius thanks for catching this! 🙏 I've opened a PR.

@gustavdelius
Copy link
Contributor Author

@maelle , then you can close my pull request for fixing this #1655

@maelle
Copy link
Collaborator

maelle commented May 1, 2021

oh sorry I had missed it 🤦‍♀️ Your regex might actually be more elegant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior
Projects
None yet
3 participants