From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id mGEYLzi/Yl9VdAAA0tVLHw (envelope-from ) for ; Thu, 17 Sep 2020 01:43:20 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id uDbcKji/Yl8rJAAAB5/wlQ (envelope-from ) for ; Thu, 17 Sep 2020 01:43:20 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 9D1B79403C5 for ; Thu, 17 Sep 2020 01:43:19 +0000 (UTC) Received: from localhost ([::1]:37952 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kIixC-00085n-Ka for larch@yhetil.org; Wed, 16 Sep 2020 21:43:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60336) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kIiwZ-00085e-AN for emacs-orgmode@gnu.org; Wed, 16 Sep 2020 21:42:39 -0400 Received: from pb-smtp21.pobox.com ([173.228.157.53]:52738) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kIiwW-0005Ln-2K for emacs-orgmode@gnu.org; Wed, 16 Sep 2020 21:42:38 -0400 Received: from pb-smtp21.pobox.com (unknown [127.0.0.1]) by pb-smtp21.pobox.com (Postfix) with ESMTP id C3370E8B00; Wed, 16 Sep 2020 21:42:30 -0400 (EDT) (envelope-from kyle@kyleam.com) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:in-reply-to:references:date:message-id:mime-version :content-type; s=sasl; bh=p8Zk15FFR+paY4QewBMA7MeUFQA=; b=yWHExz URtEe0IhKqbeTSkFa2YIXo0W0FGVn1W6xE9wd4gh/PlmXQrZxpzEbPJ2wvyMmE/w 1IW8CuxUsruyp1DTDSHDuUujzfYZNofVnIEFEPekOyhtxwBrX6OWIS3lidL5AKlD mUG/koOv/usm3s0GIYphMom0aR+PZau+Qyxmk= Received: from pb-smtp21.sea.icgroup.com (unknown [127.0.0.1]) by pb-smtp21.pobox.com (Postfix) with ESMTP id AFB9BE8AFF; Wed, 16 Sep 2020 21:42:30 -0400 (EDT) (envelope-from kyle@kyleam.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=kyleam.com; h=from:to:cc:subject:in-reply-to:references:date:message-id:mime-version:content-type; s=mesmtp; bh=sdR04+9/LaXG4TkY6nyMgeSExAifr8AhoZX6Ec7gC4s=; b=YZXNxztp3FTX1qkrIiBocPF7hL32THDO8UU/AhsyVO+nuT0l89FLG9VNO64VtvvnmEiHhOg9B04qQa+OzZBBn8hI6otOrhDU9S5ZYkNQtnsj2IefpBg6yqZKsrfaM8Wl5QUi2mOetiUcDzEImY76wMyOm6ANJ19s39pRW65GW2w= Received: from localhost (unknown [45.33.91.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp21.pobox.com (Postfix) with ESMTPSA id 192F5E8AFE; Wed, 16 Sep 2020 21:42:28 -0400 (EDT) (envelope-from kyle@kyleam.com) From: Kyle Meyer To: Tim Quelch Subject: Re: Configuring text export block output In-Reply-To: <87o8m5p5y9.fsf@quelch.name> References: <87o8m5p5y9.fsf@quelch.name> Date: Wed, 16 Sep 2020 21:42:26 -0400 Message-ID: <87h7rx89h9.fsf@kyleam.com> MIME-Version: 1.0 Content-Type: text/plain X-Pobox-Relay-ID: 0B3F6D22-F887-11EA-A44A-843F439F7C89-24757444!pb-smtp21.pobox.com Received-SPF: pass client-ip=173.228.157.53; envelope-from=kyle@kyleam.com; helo=pb-smtp21.pobox.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/16 21:42:30 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: emacs-orgmode@gnu.org Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=pobox.com header.s=sasl header.b=yWHExz U; dkim=pass header.d=kyleam.com header.s=mesmtp header.b=YZXNxztp; dmarc=none; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Spam-Score: -1.21 X-TUID: EoKINWxzAdnS Tim Quelch writes: > For example if I have a source block > > #+begin_src python > Some code here > with multiple lines > #+end_src > > With `org-ascii-export-as-ascii` the above block gives: > > ,---- > | Some code here > | with multiple lines > `---- > > I don't really like this as the '|' at the start of the lines make it > annoying to copy and paste. Is there a way to configure the export to > give something surrounded by backticks? > > ```python > Some code here > with multiple lines > ``` > > I've had a look into the available `org-ascii-*` customise variables and > I couldn't see anything which looked to give this functionality. I don't think ox-ascii has an option to control that, but you could get the behavior you're after by creating a derived backend. In fact, the section of the manual that covers derived backends provides an example of extending the ox-ascii backend to tweak the rendering of the source blocks. (info "(org)Advanced Export Configuration") You'd only need to modify that slightly, rewriting the my-ascii-src-block function to do what you want. Something like (defun my-ascii-src-block (src-block contents info) (concat "```" (org-element-property :language src-block) "\n" (org-element-normalize-string (org-export-format-code-default src-block info)) "```"))