all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Markdown export (using org-export-generic)
@ 2011-08-17  2:20 Paul Sexton
  2011-08-17  2:38 ` Jambunathan K
  0 siblings, 1 reply; 5+ messages in thread
From: Paul Sexton @ 2011-08-17  2:20 UTC (permalink / raw)
  To: emacs-orgmode

Wes Hardaker's org-export-generic (in worg) does a pretty good job of 
exporting to markdown syntax. The following works (use C-c C-e g to 
run the exporter):

(require 'org-export-generic)
(org-set-generic-type
 "markdown" 
 '(:file-suffix     ".markdown"
   :key-binding     ?M
   :title-format    "Title: %s\n"
   :date-format     "Date: %s\n"
   :toc-export      nil
   :author-export   t
   :tags-export     nil
   :drawers-export  nil
   :date-export     t
   :timestamps-export  t
   :priorities-export  nil
   :todo-keywords-export t
   :body-line-fixed-format "\t%s\n"
   ;:body-list-prefix "\n"
   :body-list-format "- %s"
   :body-list-suffix "\n"
   :header-prefix ("" "" "### " "#### " "##### " "###### ")
   :body-section-header-prefix ("" "" "### " "#### " "##### " "###### ")
   :body-section-header-format "%s\n"
   :body-section-header-suffix (?= ?- "")
   :body-header-section-numbers nil
   :body-header-section-number-format "%s) "
   :body-line-format "%s\n"
   :body-newline-paragraph "\n"
   :bold-format "**%s**"
   :italic-format "_%s_"
   :verbatim-format "`%s`"
   :code-format "`%s`"
   :body-line-wrap   75
   ))

There are some defects however, which an't really be fixed without altering
the exporter code. The main ones are:

1. Nested lists don't seem to be supported.

2. Tables come out as:

col 1    col 2
-------+-------
     1       2
     3       4

But need to look like this:

|col 1  | col 2 |
|-------|-------|
|     1 |      2|
|     3 |      4|

3. Links are not exported correctly.

A link [[http://www.google.com][like this]] comes out as

A link [like this]
...
[like this]: http://www.google.com

But need to look either like:

A link [like this][1]
...
[1]: http://www.google.com

Or like:

A link [like this](http://www.google.com)

Paul

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

* Re: Markdown export (using org-export-generic)
  2011-08-17  2:20 Markdown export (using org-export-generic) Paul Sexton
@ 2011-08-17  2:38 ` Jambunathan K
  2011-08-17 21:16   ` Paul Sexton
  0 siblings, 1 reply; 5+ messages in thread
From: Jambunathan K @ 2011-08-17  2:38 UTC (permalink / raw)
  To: Paul Sexton; +Cc: emacs-orgmode


Paul

> Wes Hardaker's org-export-generic (in worg) does a pretty good job of 
> exporting to markdown syntax. The following works (use C-c C-e g to 
> run the exporter):

> There are some defects however, which an't really be fixed without altering
> the exporter code. The main ones are:

May be you could cook something up with org-lparse? The file is in
contrib dir and org-xhtml and ord-odt make use of it.

Jambunathan K.

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

* Re: Markdown export (using org-export-generic)
  2011-08-17  2:38 ` Jambunathan K
@ 2011-08-17 21:16   ` Paul Sexton
  2011-08-17 22:26     ` Jambunathan K
  0 siblings, 1 reply; 5+ messages in thread
From: Paul Sexton @ 2011-08-17 21:16 UTC (permalink / raw)
  To: emacs-orgmode

Jambunathan K <kjambunathan <at> gmail.com> writes:
> May be you could cook something up with org-lparse? The file is in
> contrib dir and org-xhtml and ord-odt make use of it.

Thanks, it looks interesting, but I can't find any documentation?

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

* Re: Markdown export (using org-export-generic)
  2011-08-17 21:16   ` Paul Sexton
@ 2011-08-17 22:26     ` Jambunathan K
  2011-08-17 22:49       ` Jambunathan K
  0 siblings, 1 reply; 5+ messages in thread
From: Jambunathan K @ 2011-08-17 22:26 UTC (permalink / raw)
  To: Paul Sexton; +Cc: emacs-orgmode

Paul Sexton <psexton.2a@gmail.com> writes:

> Jambunathan K <kjambunathan <at> gmail.com> writes:
>> May be you could cook something up with org-lparse? The file is in
>> contrib dir and org-xhtml and ord-odt make use of it.
>
> Thanks, it looks interesting, but I can't find any documentation?

You need to rely on the docstrings for the most part. Please take a look
at the initial commentary section of org-lparse.el.

The docstring for org-lparse-native-backends should a good starting
point [1]. You will start with adding an entry to this variable and
start exporting with M-x org-lparse.

Another way to proceed is 

- Start with a sample org file [2]
- Enable debug logs in the exported file

  (setq org-lparse-debug t)

- Do a org-export-as-xhtml

- Open the resulting html file and take a Look at the comments embedded
  in it. You will have a feel for how the format and entity callbacks
  are invoked (See docstring below for the format and entity callbacks)

- Keep modifying org-xhtml.el until it becomes a org-markdown.el

org-lparse is reasonably mature and you are less likely to burn your
fingers badly with it.

Jambunathan K.

Footnotes: 
[1]  org-lparse-native-backends

,----[ C-h v org-lparse-native-backends RET ]
| org-lparse-native-backends is a variable defined in `org-lparse.el'.
| Its value is ("odt" "xhtml")
| 
| 
| Documentation:
| List of native backends registered with `org-lparse'.
| A backend can use `org-lparse-register-backend' to add itself to
| this list.
| 
| All native backends must implement a get routine and a mandatory
| set of callback routines.
| 
| The get routine must be named as org-<backend>-get where backend
| is the name of the backend.  The exporter uses `org-lparse-get'
| and retrieves the backend-specific callback by querying for
| ENTITY-CONTROL and ENTITY-FORMAT variables.
| 
| For the sake of illustration, the html backend implements
| `org-xhtml-get'.  It returns
| `org-xhtml-entity-control-callbacks-alist' and
| `org-xhtml-entity-format-callbacks-alist' as the values of
| ENTITY-CONTROL and ENTITY-FORMAT settings.
| 
| [back]
`----

[2] Download the test.org file in the link below
http://repo.or.cz/w/org-mode/org-jambu.git/blob_plain/HEAD:/contrib/odt/tests/

This is the unit test file that I used for developing the exporter. It
is a GOOD starting point and should give reasonably a COMPREHENSIVE
coverage.



-- 

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

* Re: Markdown export (using org-export-generic)
  2011-08-17 22:26     ` Jambunathan K
@ 2011-08-17 22:49       ` Jambunathan K
  0 siblings, 0 replies; 5+ messages in thread
From: Jambunathan K @ 2011-08-17 22:49 UTC (permalink / raw)
  To: Paul Sexton; +Cc: emacs-orgmode


> [2] Download the test.org file in the link below
> http://repo.or.cz/w/org-mode/org-jambu.git/blob_plain/HEAD:/contrib/odt/tests/

The repo is refusing to a do dir listing. So here is the link to the
actual file

http://repo.or.cz/w/org-mode/org-jambu.git/blob_plain/HEAD:/contrib/odt/tests/test.org

Side note: For prototype purposes, you can start with the headline
titled "* Sample Content (Proof Of Concept)". Once that is marked as
done you can proceed to headline titled "ODT Exporter". The tree under
later headline is complex in the sense that it tests the export of TODO,
tagged and timestamp entries.


> This is the unit test file that I used for developing the exporter. It
> is a GOOD starting point and should give reasonably a COMPREHENSIVE
> coverage.

-- 

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

end of thread, other threads:[~2011-08-17 22:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-17  2:20 Markdown export (using org-export-generic) Paul Sexton
2011-08-17  2:38 ` Jambunathan K
2011-08-17 21:16   ` Paul Sexton
2011-08-17 22:26     ` Jambunathan K
2011-08-17 22:49       ` Jambunathan K

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.