From: Kyle Meyer <kyle@kyleam.com>
To: Tim Quelch <tim@tquelch.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Configuring text export block output
Date: Wed, 16 Sep 2020 21:42:26 -0400 [thread overview]
Message-ID: <87h7rx89h9.fsf@kyleam.com> (raw)
In-Reply-To: <87o8m5p5y9.fsf@quelch.name>
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))
"```"))
next prev parent reply other threads:[~2020-09-17 1:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-17 1:06 Configuring text export block output Tim Quelch
2020-09-17 1:42 ` Kyle Meyer [this message]
2020-09-17 2:17 ` Tim Quelch
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87h7rx89h9.fsf@kyleam.com \
--to=kyle@kyleam.com \
--cc=emacs-orgmode@gnu.org \
--cc=tim@tquelch.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).