emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: John Kitchin <jkitchin@andrew.cmu.edu>
To: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: fixing level in md export
Date: Mon, 15 May 2017 09:29:22 -0400	[thread overview]
Message-ID: <m2y3tyxn7x.fsf@andrew.cmu.edu> (raw)

Hi,

I used to use a snippet like this to convert "** test" to "## test", but
recently this quit working:

#+BEGIN_SRC emacs-lisp
(cl-flet ((org-export-get-relative-level           
			(headline info)
			(org-element-property :level headline)))
	       (s-trim
		(org-export-string-as
		 "** test"
		 'md t '(:with-toc nil :with-tags nil))))
#+END_SRC

#+RESULTS:
: # test

As far as I can tell, the cl-flet is not doing anything here. It works
in other places, e.g.

#+BEGIN_SRC emacs-lisp
(cl-flet ((print (args) (message "yoes: %s" args))) (print 6))
#+END_SRC

#+RESULTS:
: yoes: 6

I am using: GNU Emacs 25.1.1 (x86_64-apple-darwin16.4.0, NS appkit-1504.81 Version 10.12.3 (Build 16D32)) of 2017-04-04
Org mode version 9.0.5 (9.0.5-elpa @ /Users/jkitchin/vc/jkitchin-github/scimax/elpa/org-20170210/)



The background on this is I am exporting "cells" to markdown to make a
jupyter notebook, and ox-md-headline uses org-export-get-relative-level
to figure out how many leading # to put in. For what I am doing this is
not correct. The cells get rendered out of context, so this ends up
making all levels be level 1.

Any ideas on how to remedy this? Or why it might have stopped working?

--
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu

                 reply	other threads:[~2017-05-15 13:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=m2y3tyxn7x.fsf@andrew.cmu.edu \
    --to=jkitchin@andrew.cmu.edu \
    --cc=emacs-orgmode@gnu.org \
    /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).