From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/33076 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: bapt a Newsgroups: gmane.text.pandoc Subject: markdown to markdown, stripping Yaml comments and keeping 3-backticks code blocks intact Date: Sat, 26 Aug 2023 12:57:10 -0700 (PDT) Message-ID: <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_34996_1034686684.1693079830579" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3279"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBDG3FYUYQUCBBF5SVGTQMGQEGWTMHZA-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Sat Aug 26 21:57:16 2023 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-oo1-f59.google.com ([209.85.161.59]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1qZzPI-0000gx-8v for gtp-pandoc-discuss@m.gmane-mx.org; Sat, 26 Aug 2023 21:57:16 +0200 Original-Received: by mail-oo1-f59.google.com with SMTP id 006d021491bc7-56d43b5863fsf2124965eaf.0 for ; Sat, 26 Aug 2023 12:57:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20221208; t=1693079834; x=1693684634; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:x-original-sender :mime-version:subject:message-id:to:from:date:sender:from:to:cc :subject:date:message-id:reply-to; bh=x8V2jO82Hj/UiOoxo1nJucKkaUN+8IZToc+7w+rSMb0=; b=ik+Iv7Ycbt6+hU5mePIDD6Iv0huRqV/J1glTq5iNsLJzukHi1Bs65G4OgiBdXAMmWo FkwlWMyvk/4DWQpFF1oFgwtGM9pYaPm51pPtoOt35iMzZhrdfyQNiCyeFfcbj7Y+JQ5K uNNqW8Ly0JXJ7OEcY7bbByrY7haaAL9hCB7it6UkU3tlFbRser4BvR55v5Lko1zAU5bv yoPA6+diwaOuKWBlEEOMAN7S/YwN8NbtHRQ7w9KFlGqb9QotmOrVX94eD6fcU04WHXFE LHW2OzSZG814FVwnxMasab0SuFlR/TXNiPGlfH1L9dMWd2Jmf89N9tu59Zae/kKlnIh9 Tqvg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693079834; x=1693684634; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:x-original-sender :mime-version:subject:message-id:to:from:date:from:to:cc:subject :date:message-id:reply-to; bh=x8V2jO82Hj/UiOoxo1nJucKkaUN+8IZToc+7w+rSMb0=; b=LAftCIXs58PS0LejS0Elc71dmvaRF3TU5XWN+Ues6u+azs6qPrsUCBCXoxS/cllAA+ AomGIf6NHm6km6/T2PNLEoLhEIBHz9K3G2OQ2hrIpZHUBmMgQBkl9E/5lodNWUL638Kc wMaCDm5NUxMfABJSwuWKr5xCWtR7sGtB6YhK5ePZbn9PnaYUh+FrXIJcenawxsKdIram Gt5T9qtKrOddv9bY4iajjtT5bf5OUqGo8wu8csm0Ok9gDAM4Kttd52aa3G9dCUCBZwhm tWPXrtf6wO5VjzredUSo50flcGMMQ5OksddnFcHoU0aaQtVCDGeJwkKHyA23bWtxJwPB VXzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693079834; x=1693684634; 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:message-id:to:from:date :x-beenthere:x-gm-message-state:sender:from:to:cc:subject:date :message-id:reply-to; bh=x8V2jO82Hj/UiOoxo1nJucKkaUN+8IZToc+7w+rSMb0=; b=KftqOMNHcLXUjH6UzfGZJUNBOc+iCbFEJxQHhviwd/s6yoHlc5miOEBERwNOYtqEj8 F4n2NWGTsLqzbFpqBexvJxwyC2wVTm/pQ4N0+TzbJeQjO5MWrmzjSzLrPs5lUnlfzYF9 g+Ed/LjL9B5xazk2Gw0YFFls3sz/r8vn3n8bcwp5eSORG2HRUwdi88cJ0hAHDop3wfMR OOHGW+iUPC0j3oulNBBGm8EevU8t6/jA+7yFHoDQfrfDGeHeLplrqcDFmM34sSV5EYJw fLyw6ZhjR3Tgg+6B615CZ4RE4/hP7zmBeMrAOugZst03+bu0HEunWqKRpeqXD5YdBGQT Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOJu0Yw8sjqPTkfa02ENFVEDbWWZiESDFH9V52Lob6lRMycB3gFOqNBC iyRptc0KU0rnz4UPO/hdIg4= X-Google-Smtp-Source: AGHT+IFO4FcQVxKeVhhbKCxBIBT2YkJNxIyRg18O6JQ1ccmjckWaHQ/niKh2fOaQppUgXAIBsRFInQ== X-Received: by 2002:a4a:2a0d:0:b0:573:55f4:516a with SMTP id k13-20020a4a2a0d000000b0057355f4516amr2659666oof.3.1693079834710; Sat, 26 Aug 2023 12:57:14 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a4a:45c9:0:b0:573:4d39:2d64 with SMTP id y192-20020a4a45c9000000b005734d392d64ls656560ooa.2.-pod-prod-00-us; Sat, 26 Aug 2023 12:57:11 -0700 (PDT) X-Received: by 2002:a05:6808:1596:b0:3a7:4a41:189b with SMTP id t22-20020a056808159600b003a74a41189bmr599635oiw.4.1693079831200; Sat, 26 Aug 2023 12:57:11 -0700 (PDT) X-Original-Sender: auguieba-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:33076 Archived-At: ------=_Part_34996_1034686684.1693079830579 Content-Type: multipart/alternative; boundary="----=_Part_34997_285318576.1693079830579" ------=_Part_34997_285318576.1693079830579 Content-Type: text/plain; charset="UTF-8" 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/9abf1645-7bd2-427c-846e-1b2e7a438760n%40googlegroups.com. ------=_Part_34997_285318576.1693079830579 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,

I'm playing with an idea for quarto, wh= ere 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 bloc= ks can appear anywhere in a pandoc document, and 2) commented out (#) lines= in Yaml are stripped by pandoc (?).

I'd l= ike to run a pre-processing step* on the input document to return essential= ly the same input, but getting rid off those commented out Yaml lines.

Consider the following input file,
<= br />
``````
---
title: Comment
---

## Section

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


```{r}
x <- 1 + 1
x<= br />```

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 calls the computational engine, otherwise the code s= till gets executed.

I've tried various fla= vours of markdown, such as

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

where noop.lua is a dummy Writer doing nothing,

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

but I'm not find= ing the right combination of options, if there is one. Some markdown flavou= rs seem to keep the Yaml comments (not sure why), others reformat the 3-bac= kticks code block. Is this "identity" Writer going to be difficult to achie= ve?

Many thanks,

baptiste

* Note that code is currently detected vi= a 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).
See https://github.com/quar= to-dev/quarto-cli/discussions/3330 for more context

--
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/9abf1645-7bd2-427c-846e-1b2e7a438760n%40googlegroups.= com.
------=_Part_34997_285318576.1693079830579-- ------=_Part_34996_1034686684.1693079830579--