-
Notifications
You must be signed in to change notification settings - Fork 2
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
Knitted output #2
Comments
Interestingly, the current pkgdown docs featured coloured output for collateral output in the reference pages, even though other pages (like knitted chunks on the home page) do not. Getting to the bottom of that difference might shed some light on this! On the topic references: On the home page: The chunk option |
More notes to myself on colourisation (which doesn't appear to be on the radar at the moment, going by issues 916 and 958 of pkgdown). As far as I can tell, there are no differences in the way pkgdown attempts to render the article pages (including the homepage) and the example sections of reference topic pages. However, the code and output is marked up differently (regardless of whether colour or formatting is involved). One exception to this is links, which are marked up correctly in both kinds of page. The templates are mostly similar, but the content of articles is inserted simply using
The resultant code for articles has each line marked up with either In example sections, the wrapping code block is a Output blocks being broken up with spans for crayon effects is funamentally the difference between articles and reference topics, but reference topics also group input and output into sub-blocks that are differentiated and well-structured. Articles appear to try and treat the input and output line by line, although code that isn't marked up for a link or some sort of input token end up being entirely unwrapped (and include raw new lines). It's also worth noting that the CSS involved here isn't contingent on the classes of the wrapping Why are they processed differently? It seems like this is probably down to how the whisker package handles the templates. The whisker documentation notes that the {{{triple brace}}} prevents HTML escaping. This pattern is used in examples blocks, suggesting that colourisation markup is anticipated in examples sections, but no such escaping is done in the article template. But what causes the crayon tags to be added in the first place (or does escaping simply mean stripping for the articles)? When Relevant function stack: For reference topics:
For articles and home page:
So, tl;dr, it's two diferent rendering engines—examples use the evaluate package and whisker, and articles and the home page use Rmarkdown. This SO answer suggests using a knitr hook to add colouration with If this is fundamentally an Rmarkdown issue, then fixing it might yield some more insights for the general question, which is about coloured knitr |
Also note that the And it uses |
At the moment, it's possible to get collateral to print in knitted documents by using the native terminal output. But paged HTML tables of tibbles simply show the list-column class name. I'd like to fix this!
EDIT: I'm going to refocus this issue on coloured terminal output for knitr/rmarkdown for now and return to HTML table output later!
The text was updated successfully, but these errors were encountered: