added "rmarkdown" engine to process code blocks#1683
Open
dgkf wants to merge 1 commit intoyihui:masterfrom
Open
added "rmarkdown" engine to process code blocks#1683dgkf wants to merge 1 commit intoyihui:masterfrom
dgkf wants to merge 1 commit intoyihui:masterfrom
Conversation
yihui
reviewed
Mar 26, 2019
Owner
yihui
left a comment
There was a problem hiding this comment.
Thanks! I don't have time to think about it carefully at the moment. You should probably call knit_child() instead of knit() here. Anyway, I guess the problem should not really block you, because there are at least two ways out:
-
You can register the engine by yourself via
knitr::knit_engines$set(rmarkdown = function(options) ...); -
Or use child documents (which will require the commentary to be written to external files, and you may not like that).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I ran into a situation where I wanted to be able to turn on or off different pieces of commentary in the markdown throughout a document. For example, I would ideally like to set a flag to include more technical commentary for an analytic audience, but then strip them out for a general audience.
Although the
asisengine works in most cases, it doesn't process inline code blocks that I often use for communicating results. To address this, I added a newrmarkdownengine to pre-process the text usingknitr::knit.Here is an example document where this is useful:
let me know if any tests should be added. I couldn't find any for the
asisengine and figured this would only necessitate a similar level of testing.