From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/33081 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jonathan Whiteley Newsgroups: gmane.text.pandoc Subject: Re: markdown to markdown, stripping Yaml comments and keeping 3-backticks code blocks intact Date: Tue, 29 Aug 2023 06:40:06 -0700 (PDT) Message-ID: <6e4c86d9-f030-4dcd-bf04-b9ff68b8981fn@googlegroups.com> References: <9abf1645-7bd2-427c-846e-1b2e7a438760n@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_12656_834595490.1693316406400" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22468"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBDPYXQF2QQJRBN7KW6TQMGQETMLCK2A-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Tue Aug 29 15:40:10 2023 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-ot1-f60.google.com ([209.85.210.60]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1qayx0-0005gN-L7 for gtp-pandoc-discuss@m.gmane-mx.org; Tue, 29 Aug 2023 15:40:10 +0200 Original-Received: by mail-ot1-f60.google.com with SMTP id 46e09a7af769-6bd899e2d3asf4676692a34.3 for ; Tue, 29 Aug 2023 06:40:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20221208; t=1693316409; x=1693921209; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:x-original-sender :mime-version:subject:references:in-reply-to:message-id:to:from:date :sender:from:to:cc:subject:date:message-id:reply-to; bh=E7M72mBjYV9uXO36IGf6chFBbGwIEGSAKrL+Gzt3kIk=; b=XN1HHc0AtNKPUCUEPTt2G1nqJ93G2yotEkgq2jnVkzIz707GN9IbXBMX9u3L5ME4hO Eyrr5hGfWcvX1Uud3FGCjeaFmmmIt0SXubi3PS3jfEW6jIe70vbPjOKfIT3xLTmlElX/ 7un4S+CSQuSzF/HmNhJ5B9XDxE9b/s5yeEET5J1jv5B1XU59MH/CGhrY7QFIMLeYc7UI l3C6WpUTI6O+c7YGxuhdgyhgU61SOguELs2C66//5w7+HDRRcJHyhhBveCy4oLlyakd9 Ylpxjt/pR59OEn6VlVdM6VDbSL8be7sV3TbNpfxUPwTM0D2o8nPPGlyU7CUaGf4kjOwj gW/Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693316409; x=1693921209; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:x-original-sender :mime-version:subject:references:in-reply-to:message-id:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=E7M72mBjYV9uXO36IGf6chFBbGwIEGSAKrL+Gzt3kIk=; b=sAufG+AgDdIOeN0GoxjbkguSpGg62vfJV1gnAUEuFrcYd1UctMuejwcU3EgazNJNGI KSdBbBPWvD3IUlZDGmcEoY3ZYG3gisIQm8OBYPgbEjJWUvz6QMGFHi1P3yKSa8Pqp6dD VkXHkfc8AVFKFaUCcfKvTuAbbmHAAM2R2LRvy4QJkX8AUS6PcnSoPdqhBJd/Z0r74imT RVdUQ8kBnNBwY5ZLRPywvFleooYAzVToJbcdw28mdRrwEoe5mjihohJzPY3nWZB8TeAY sDJxdQiNhnCjE9J9N3P8OT9P6mSYKKqsYENUKDK70g9v5jpGNz6XSWMJs1Wa0hOTTOx+ jzXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693316409; x=1693921209; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence:reply-to :x-original-sender:mime-version:subject:references:in-reply-to :message-id:to:from:date:x-beenthere:x-gm-message-state:sender:from :to:cc:subject:date:message-id:reply-to; bh=E7M72mBjYV9uXO36IGf6chFBbGwIEGSAKrL+Gzt3kIk=; b=Y/1kELRxGhmm7lfU1j4AmKC0SmoCOx9brkXLjOr7oR4P6qp5PlndvRpl+J+i2aBX69 ZPvepO9V9bLqGgk4njT402j078fKoEwTBmVnNvkI7GSrtSn8MFsZLe3RyOpJv1hk4hOX MAeL2DZ6xM2E3kVeLboLzbkZIxBnN8OV3Us+64JE6NfLhJSjOAktAWK3fipLmZGN8jtj CQ0TsH/U625TMFGF3oYiPK+P7BMFRsbw9e1pRfchZ7mvYL0ookOV6oQLJPJEy4sP9QTH 3ZwMReLFFDr1R/iQRZXA+LzwjjZ/PAEexXMao2gqP7FcKIeGg5 Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOJu0YzHSG5R+ZA948Y9MX7xa6DhBKyoyB7A/0AkVdYojI75KElwkMCj gu7sDab+tteWtCEMbCCHG/g= X-Google-Smtp-Source: AGHT+IEsjE/kDfKUV3J039zlcOQjApl78i+t0KoXPOHIzJdfoQh65OucQDx6UxxycN5Lf0gsOctqFw== X-Received: by 2002:a05:6871:891:b0:1c5:56f:ac08 with SMTP id r17-20020a056871089100b001c5056fac08mr16626281oaq.12.1693316409596; Tue, 29 Aug 2023 06:40:09 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a05:6870:438c:b0:1c0:3491:bd17 with SMTP id r12-20020a056870438c00b001c03491bd17ls6125802oah.0.-pod-prod-08-us; Tue, 29 Aug 2023 06:40:07 -0700 (PDT) X-Received: by 2002:a9d:6858:0:b0:6b9:5bfc:9b33 with SMTP id c24-20020a9d6858000000b006b95bfc9b33mr914255oto.6.1693316406974; Tue, 29 Aug 2023 06:40:06 -0700 (PDT) In-Reply-To: <9abf1645-7bd2-427c-846e-1b2e7a438760n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> X-Original-Sender: jaw.biodude-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Precedence: list Mailing-list: list pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org; contact pandoc-discuss+owners-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org List-ID: X-Google-Group-Id: 1007024079513 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Xref: news.gmane.io gmane.text.pandoc:33081 Archived-At: ------=_Part_12656_834595490.1693316406400 Content-Type: multipart/alternative; boundary="----=_Part_12657_1100035368.1693316406400" ------=_Part_12657_1100035368.1693316406400 Content-Type: text/plain; charset="UTF-8" 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. ------=_Part_12657_1100035368.1693316406400 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I would love a way to "comment out" blocks of Markdown.=C2=A0 The only= way I've been able to do it in R Markdown is to wrap the contents in a R c= ode chunk with `eval=3DFALSE, include=3DFALSE`, to stop knit() from evaluat= ing it, and removing it from the intermediate md output.=C2=A0 Of course, s= uch a block can not contain other nested R-code chunks, unless they are com= mented-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=3DFALSE, include=3DFALSE}
You can embed = code like this:

# ```{r}
# 1 + 1
# ```
but beware= , is `r .NotYetImplemented()` still executed?
```

More text= .

``````

B= est of luck,

Jonathan
On Saturday, 26 Au= gust 2023 at 15:57:10 UTC-4 bapt a wrote:
Hi,

I'm play= ing with an idea for quarto, where one could comment out portions of the in= put 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 inp= ut document to return essentially the same input, but getting rid off those= commented out Yaml lines.

Consider the follow= ing input file,

``````
---
title: Com= ment
---

## Section

This is a simple placeholder for the m= anuscript's main document [@knuth84].


```{r}
x <- 1 + = 1
x
```

Note pi is `r pi`.

---
#=C2=A0 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 ca= lls the computational engine, otherwise the code still gets executed.

I've tried various flavours of markdown, such a= s

> quarto pandoc -t noop.lua =C2=A0-f=C2=A0mar= kdown=C2=A0 index.qmd

where noop.lua is a dummy Wr= iter doing nothing,

```
function Wri= ter (doc, opts)
=C2=A0 local filter =3D {=C2=A0 }
=C2=A0 return pando= c.write(doc:walk(filter), 'markdown', opts)
end
````

but I'm not finding the right combination of optio= ns, 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 "i= dentity" Writer going to be difficult to achieve?

Many thanks,

baptiste

*= Note that code is currently detected via regex in quarto, so it gets=20 executed even inside comments (hence the need of a pre-processor to=20 strip it entirely from the document).

--
You received this message because you are subscribed to the Google Groups &= quot;pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an e= mail to pand= oc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@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.
------=_Part_12657_1100035368.1693316406400-- ------=_Part_12656_834595490.1693316406400--