From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lars Tveito Subject: Re: Add-on: Github Flavored Markdown exporter Date: Tue, 08 Apr 2014 23:39:28 +0200 Message-ID: References: <87a9bwbx6t.fsf@gmail.com> <878urg12im.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:59347) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WXdk8-0003Sx-Jk for emacs-orgmode@gnu.org; Tue, 08 Apr 2014 17:39:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WXdk3-00037R-7O for emacs-orgmode@gnu.org; Tue, 08 Apr 2014 17:39:44 -0400 Received: from mail-out5.uio.no ([129.240.10.17]:37041) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WXdk2-00036p-SO for emacs-orgmode@gnu.org; Tue, 08 Apr 2014 17:39:39 -0400 In-reply-to: <878urg12im.fsf@gmail.com> 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Thorsten Jolitz Cc: emacs-orgmode@gnu.org Hi, thanks for checking it out! Thorsten Jolitz writes: > Thorsten Jolitz writes: > >> Lars Tveito writes: >> >>> Hi! >>> >>> I have written an exporter for Github Flavored Markdown, which is a >>> derived back-end from the Markdown (vanilla) exporter. It adds >>> Github-style src-blocks, strike-through and table of contents. > > Your library works really good, thanks. I would recommend adding it to > /contrib. I used it to create new README.md files for all three > libraries navi-mode.el, outorg.el and outshine.el, you can find the > repos on github.com/tj64 if you want to take a look. > I try adding it soon. Checked out your README'S, looks good! > I like the idea very much to write this documentation stuff once in one > place and then reuse it in all other places. Therefore when I write a > source file, I use outorg to write a more or less sophisticated comment > header for that file. This is then automatically converted back to a > programming language comment section, but I can always convert it back > to Org-mode. From the outorg-edit-buffer, I can then export it to html, > latex, ascii and now to markdown-github-flavor too, whats nice. > > I use a little trick to do this: > I narrow the buffer to the first 1st level headline, and then use > > ,-------------- > | C-1 M-# M-# > | C-u 1 M-# M-# > `-------------- > > to temporarily insert the default export template, or > > ,-------------- > | C-3 M-# M-# > | C-u 3 M-# M-# > `-------------- > > to temporarily insert a custom export template from a file. > > A few questions and remarks: > > - I get the best results with just using example blocks - is it supposed > to work with source-blocks and other blocks too? > Getting it to work with source-blocks was the feature I missed the most from the vanilla markdown exporter. If you specify a language in the source-block it will be added to the exported version as well; a problem occurs if you specify a language not supported by Github. Emacs lisp is an example of this, so there is a alist `org-gfm-lang' which by default has the value: (("emacs-lisp" . "lisp") ("elisp" . "lisp")) So a source block like this: #+begin_src emacs-lisp (defun foo () 'foo) #+end_src exports to this: ```lisp (defun foo () 'foo) ``` Which provides syntax highlighting in Github Flavored Markdown. > - Just like the Org exporter in general, it does not know how to deal > with boxes made with rebox2.el, so I replaced them with example > blocks. > I am not familiar with rebox2.el. This back-end inherits most functionality from the markdown (vanilla) exporter, which again inherits from the html exporter. Since rebox2.el doesn't play nice with any of those it will cause problems with the github flavored as well. If you'd like the boxes created with rebox2.el to appear in the exported version you could possibly wrap it inside an example-block. > - What about numbered lists with longer text/blocks as item content - is > the item numbering supposed to work? I hadn't tested this, but found an old org-file with notes packed with different lists. I generated it, and most of it looks good: https://gist.github.com/anonymous/694b7b5f53dd21850bcd (by the way, the content is rubbish, and in Norwegian). The only problems are with latex-code mixed in the document and sloppy work from the original org file. - Lars