-
Notifications
You must be signed in to change notification settings - Fork 22
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
allow for bookdown hacking? #53
Conversation
My bookdown bookdown::gitbook:
css: style.css
highlight: NULL where style.css contains styling for Chroma classes. Then I run bookdown::render_book(".")
htmls <- file.path(
getwd(),
dir("docs", full.names = TRUE)
)
htmls <- htmls[grepl("\\.html$", htmls)]
purrr::walk2(
htmls, htmls,
downlit::downlit_html_path,
classes = downlit::classes_chroma()
) And the gitbook looks really nice. But maybe I'll have to wait for actual downlit support in html_document() :-) |
I am now questioning my approach after seeing the use of a knitr hook in distill. At the moment I use tweaks of downlit and the tweaked build workflow (knitting, then highlighting all HTML) described above. Maybe with a hook I could do without asking for tweaks of downlit and instead my work would be a) writing the hook, saving it in a chunk in an R file b) referring to it in |
I take it back, with a hook there'd be no autolinking of inline code. |
Thanks! |
@maelle, out of curiosity, you mean with a source hook or any hooks? |
@cderv inline linking applies to |
Oh I see. 😄 Thanks ! That is obvious when you write it. 😅 |
It's only obvious to me because I tried using the inline code hook and I couldn't figure out why it didn't work 😆 |
alternative title: make
downlit_html_path()
more flexible. :-)Context: I am working on a bookdown gitbook and was trying to find a hack to use downlit before it gets really supported (so patient 🙈 ). I set bookdown's highlight parameter to
NULL
then I usedownlit::downlit_html_path()
on all resulting HTML but the HTML nodes don't have the classes downlit would expect e.g.Therefore I tweaked the xpath and now I only need to add a CSS and my gitbook will get autolinking today.
I reckon tweaking the package out of impatience is maybe not a good idea.