I would love a way to "comment out" blocks of Markdown. The only way I've been able to do it in R Markdown is to wrap the contents in a R code chunk with `eval=FALSE, include=FALSE`, to stop knit() from evaluating it, and removing it from the intermediate md output. Of course, such a block can not contain other nested R-code chunks, unless they are commented-out. `````` --- title: Comment --- ## Section This is a simple placeholder for the manuscript's main document [@knuth84]. ```{r} x <- 1 + 1 x ``` Note pi is `r pi`. ```{r comments, eval=FALSE, include=FALSE} You can embed code like this: # ```{r} # 1 + 1 # ``` but beware, is `r .NotYetImplemented()` still executed? ``` More text. `````` Best of luck, Jonathan On Saturday, 26 August 2023 at 15:57:10 UTC-4 bapt a wrote: > Hi, > > I'm playing with an idea for quarto, where one could comment out portions > of the input document including text and code chunks. This workaround would > make use of the trick that 1) Yaml blocks can appear anywhere in a pandoc > document, and 2) commented out (#) lines in Yaml are stripped by pandoc (?). > > I'd like to run a pre-processing step* on the input document to return > essentially the same input, but getting rid off those commented out Yaml > lines. > > Consider the following input file, > > `````` > --- > title: Comment > --- > > ## Section > > This is a simple placeholder for the manuscript's main document [@knuth84]. > > > ```{r} > x <- 1 + 1 > x > ``` > > Note pi is `r pi`. > > --- > # You can embed code like this: > # > # ```{r} > # 1 + 1 > # ``` > # but beware, is `r .NotYetImplemented()` still executed? > --- > > More text. > > `````` > The commented out portion should be removed before quarto calls the > computational engine, otherwise the code still gets executed. > > I've tried various flavours of markdown, such as > > > quarto pandoc -t noop.lua -f markdown index.qmd > > where noop.lua is a dummy Writer doing nothing, > > ``` > function Writer (doc, opts) > local filter = { } > return pandoc.write(doc:walk(filter), 'markdown', opts) > end > ```` > > but I'm not finding the right combination of options, if there is one. > Some markdown flavours seem to keep the Yaml comments (not sure why), > others reformat the 3-backticks code block. Is this "identity" Writer going > to be difficult to achieve? > > Many thanks, > > baptiste > > * Note that code is currently detected via regex in quarto, so it gets > executed even inside comments (hence the need of a pre-processor to strip > it entirely from the document). > See https://github.com/quarto-dev/quarto-cli/discussions/3330 for more > context > -- You received this message because you are subscribed to the Google Groups "pandoc-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/6e4c86d9-f030-4dcd-bf04-b9ff68b8981fn%40googlegroups.com.