From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: fixing level in md export Date: Mon, 15 May 2017 09:29:22 -0400 Message-ID: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:42656) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dAG40-00043O-BF for emacs-orgmode@gnu.org; Mon, 15 May 2017 09:29:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dAG3x-0002if-6M for emacs-orgmode@gnu.org; Mon, 15 May 2017 09:29:28 -0400 Received: from mail-qk0-x236.google.com ([2607:f8b0:400d:c09::236]:33535) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dAG3x-0002iN-1y for emacs-orgmode@gnu.org; Mon, 15 May 2017 09:29:25 -0400 Received: by mail-qk0-x236.google.com with SMTP id y201so95044282qka.0 for ; Mon, 15 May 2017 06:29:24 -0700 (PDT) Received: from Johns-MacBook-Air.local (KITCHIN-TIMEMACHINE.CHEME.CMU.EDU. [128.2.54.215]) by smtp.gmail.com with ESMTPSA id d21sm8579712qke.62.2017.05.15.06.29.22 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 15 May 2017 06:29:22 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: "emacs-orgmode@gnu.org" 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