emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* preserving (zero-space) indenting in begin_src when exporting/publishing (to mark-down)
@ 2020-10-28 12:54 Martin Steffen
  2020-10-28 13:53 ` Julius Dittmar
  0 siblings, 1 reply; 3+ messages in thread
From: Martin Steffen @ 2020-10-28 12:54 UTC (permalink / raw)
  To: emacs-orgmode



Hi,

I have troubles to export (or publish) some orgfiles, which contain
``src'' snippets intended for markdown. The (for me) unwelcome behavior
is the same for org-export and org-publish, I guess, since it has the
same core reason.

The problem currently for me is for the markdown format. I have seen
similar behavior for other exports, though did not care since it for
those situations, it was/is ``good enough''. Now, however, I do some
export to md, to be used for Jekyll webpages, and it's no longer good
enough.

For concreteness sake: I got some section


#+begin_src markdown
---
layout: default
title: Some Title
description: Some information
---
#+end_src


which is exported to md literally, but with 4 leading spaces as
indentation, like

    ---
    layout: default
    title: Some Title
    description: Some information
    ---

That's insofar unwelcome, as Jekyll wants those pieces of information
without indentation.

Alright, that's the situation, and the question is:

          is there a way to get rid of that

(during org-exporting/publishing, of course, not just post-processing
the md file).

This is what I tried so far. There are some variables one can tweak

1) org-src--preserve-indentation 
2) org-src-preserve-indentation 
3) org-edit-src-content-indentation

I set the 1) and 2) to "t" (also locally to the file to export). For 3),
the docs state it's about

  "Indentation for the content of a source code block."


So that sounded like it had something to do with my issue. Actually, the
original value was 2, and I set it to 0. There was no effect, the
indentation, when doing export, is still 4, as it was before setting
that to 0.


Any ideas? Thanks, Martin










^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: preserving (zero-space) indenting in begin_src when exporting/publishing (to mark-down)
  2020-10-28 12:54 preserving (zero-space) indenting in begin_src when exporting/publishing (to mark-down) Martin Steffen
@ 2020-10-28 13:53 ` Julius Dittmar
  2020-10-28 14:30   ` Martin Steffen
  0 siblings, 1 reply; 3+ messages in thread
From: Julius Dittmar @ 2020-10-28 13:53 UTC (permalink / raw)
  To: emacs-orgmode

Hi Martin,

if I understand correctly, you do not want to have a section that quotes
source code, but literal source code.

As far as I understand, that means using
#+begin_export markdown
...
#+end_export
block, not
#+begin_src markdown
...
#+end_src
block. That block will then be ignored in any other export format, and
used as-is in markdown export. (I hope "markdown" is the correct label,
I did not test it.)

Hope that helps,
Julius

Am 28.10.20 um 13:54 schrieb Martin Steffen:
> I have troubles to export (or publish) some orgfiles, which contain
> ``src'' snippets intended for markdown. The (for me) unwelcome behavior
> is the same for org-export and org-publish, I guess, since it has the
> same core reason.
>
> The problem currently for me is for the markdown format. I have seen
> similar behavior for other exports, though did not care since it for
> those situations, it was/is ``good enough''. Now, however, I do some
> export to md, to be used for Jekyll webpages, and it's no longer good
> enough.
>
> For concreteness sake: I got some section
>
>
> #+begin_src markdown
> ---
> layout: default
> title: Some Title
> description: Some information
> ---
> #+end_src
>
>
> which is exported to md literally, but with 4 leading spaces as
> indentation, like
>
>      ---
>      layout: default
>      title: Some Title
>      description: Some information
>      ---
>
> That's insofar unwelcome, as Jekyll wants those pieces of information
> without indentation.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: preserving (zero-space) indenting in begin_src when exporting/publishing (to mark-down)
  2020-10-28 13:53 ` Julius Dittmar
@ 2020-10-28 14:30   ` Martin Steffen
  0 siblings, 0 replies; 3+ messages in thread
From: Martin Steffen @ 2020-10-28 14:30 UTC (permalink / raw)
  To: Julius Dittmar; +Cc: emacs-orgmode



Great, thanks, That was it. It never occured to me that it's not
begin_src that I wanted, I just tried to tweak that one.

So, indeed:  #+begin_export markdown etc. is exactly what I need.

Thanks again.

Martin
>>>>> "Julius" == Julius Dittmar <Julius.Dittmar@gmx.de> writes:

    Julius> Hi Martin,

    Julius> if I understand correctly, you do not want to have a section
    Julius> that quotes source code, but literal source code.



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-10-28 14:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-28 12:54 preserving (zero-space) indenting in begin_src when exporting/publishing (to mark-down) Martin Steffen
2020-10-28 13:53 ` Julius Dittmar
2020-10-28 14:30   ` Martin Steffen

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).