emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Elegant way to export org to Markdown ?
@ 2021-10-02  5:20 Jean-Christophe Helary
  2021-10-02  5:55 ` Ihor Radchenko
                   ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: Jean-Christophe Helary @ 2021-10-02  5:20 UTC (permalink / raw)
  To: orgmode; +Cc: emacs-humanities

I'm trying to work with SourceHut (sr.ht) and right now they only accept Markdown syntax for their readme/wiki files.

Since I work in Emacs/org-mode to write my documents (and try to stick to that), I'd like to know if there is an elegant way to export org syntax to MarkDown.

I was thinking that the export-dispatch had an option for Plain Text / Markdown, but that doesn't seem to be the case.

As a workaround, I thought I'd work on a README.org file that I export to HTML, change the name to .md and edit the contents to reduce the markup to the strict minimum... But when I saw the contents of the HTML, I thought that would be way too much work.

*BUT* MarkDown bien basically HTML *without* the head/body tags, it seems to me that the HTML export-dispatch thing could have a "super simplified MD compatible" HTML option...

Either way, I need a method to export to something that sr.ht will recognize and process as MD so:

1) is there an external "approved" process to convert org-mode syntaxt to an MD-compatible format ?
2) if no, what is the not too hard way to hack the HTML output to produce what I need with export-dispatch ?

---side note--
And, Hello to Emacs-Humanities! I was away from the emacs-lists for a year and when I came back I found that this amazing list was born. Last year I started a "go-back-to-school" process that will eventually conclude with me finishing an MA in Japanese studies, and I wrote my first 57 pages research report last year with org-mode/Zotero/NeoOffice (a macOS only LibreOffice), and that was fun. This year I work remotely as a part-time lecturer in translation studies where I'll teach how to use free software in translation (OmegaT/Opaki Framework/Maxprograms) and I wanted to write my teaching material in org on sr.ht, but...

-- 
Jean-Christophe Helary @brandelune
https://mac4translators.blogspot.com
https://sr.ht/~brandelune/omegat-as-a-book/



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

* Re: Elegant way to export org to Markdown ?
  2021-10-02  5:20 Elegant way to export org to Markdown ? Jean-Christophe Helary
@ 2021-10-02  5:55 ` Ihor Radchenko
  2021-10-02  5:57 ` Protesilaos Stavrou
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 13+ messages in thread
From: Ihor Radchenko @ 2021-10-02  5:55 UTC (permalink / raw)
  To: Jean-Christophe Helary; +Cc: emacs-humanities, orgmode

Jean-Christophe Helary <lists@traduction-libre.org> writes:

> I'm trying to work with SourceHut (sr.ht) and right now they only accept Markdown syntax for their readme/wiki files.
>
> Since I work in Emacs/org-mode to write my documents (and try to stick to that), I'd like to know if there is an elegant way to export org syntax to MarkDown.
>
> I was thinking that the export-dispatch had an option for Plain Text / Markdown, but that doesn't seem to be the case.

I think you just need to load the markdown export backend in your
config:

(require 'ox-md)

Best,
Ihor


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

* Re: Elegant way to export org to Markdown ?
  2021-10-02  5:20 Elegant way to export org to Markdown ? Jean-Christophe Helary
  2021-10-02  5:55 ` Ihor Radchenko
@ 2021-10-02  5:57 ` Protesilaos Stavrou
  2021-10-02  6:10   ` Jean-Christophe Helary
  2021-10-02  7:44 ` Tim Cross
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 13+ messages in thread
From: Protesilaos Stavrou @ 2021-10-02  5:57 UTC (permalink / raw)
  To: Jean-Christophe Helary, orgmode; +Cc: emacs-humanities

On 2021-10-02, 14:20 +0900, Jean-Christophe Helary <lists@traduction-libre.org> wrote:

> I'm trying to work with SourceHut (sr.ht) and right now they only
> accept Markdown syntax for their readme/wiki files.
>
> Since I work in Emacs/org-mode to write my documents (and try to stick
> to that), I'd like to know if there is an elegant way to export org
> syntax to MarkDown.
>
> I was thinking that the export-dispatch had an option for Plain Text /
> Markdown, but that doesn't seem to be the case.

Hello Jean-Christophe,

Have you tried the 'ox-md' which is part of Org?  Like this:

    (require 'ox-md)
    (add-to-list 'org-export-backends 'md)

The export dispatched should then have an "Export to Markdown" option
bound to 'm'.

There are more export backends as well.  If you do M-x find-library and
search for "ox-" you will find more options.

All the best,
Protesilaos (or simply "Prot")

-- 
Protesilaos Stavrou
https://protesilaos.com


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

* Re: Elegant way to export org to Markdown ?
  2021-10-02  5:57 ` Protesilaos Stavrou
@ 2021-10-02  6:10   ` Jean-Christophe Helary
  2021-10-02  6:24     ` Ihor Radchenko
  0 siblings, 1 reply; 13+ messages in thread
From: Jean-Christophe Helary @ 2021-10-02  6:10 UTC (permalink / raw)
  To: Protesilaos Stavrou; +Cc: emacs-humanities, orgmode



> On Oct 2, 2021, at 14:57, Protesilaos Stavrou <info@protesilaos.com> wrote:
> 
> On 2021-10-02, 14:20 +0900, Jean-Christophe Helary <lists@traduction-libre.org> wrote:
> 
>> I'm trying to work with SourceHut (sr.ht) and right now they only
>> accept Markdown syntax for their readme/wiki files.
>> 
>> Since I work in Emacs/org-mode to write my documents (and try to stick
>> to that), I'd like to know if there is an elegant way to export org
>> syntax to MarkDown.
>> 
>> I was thinking that the export-dispatch had an option for Plain Text /
>> Markdown, but that doesn't seem to be the case.
> 
> Hello Jean-Christophe,
> 
> Have you tried the 'ox-md' which is part of Org?  Like this:
> 
>    (require 'ox-md)
>    (add-to-list 'org-export-backends 'md)
> 
> The export dispatched should then have an "Export to Markdown" option
> bound to 'm'.
> 
> There are more export backends as well.  If you do M-x find-library and
> search for "ox-" you will find more options.
> 
> All the best,
> Protesilaos (or simply "Prot")

Prot, Ihor,

Thank you *very much* for the pointers.

My follow-up question is, most of the ox-stuff seem to be installed by default, as far as I can tell. Why is ox-md not ?

-- 
Jean-Christophe Helary @brandelune
https://mac4translators.blogspot.com
https://sr.ht/~brandelune/omegat-as-a-book/



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

* Re: Elegant way to export org to Markdown ?
  2021-10-02  6:10   ` Jean-Christophe Helary
@ 2021-10-02  6:24     ` Ihor Radchenko
  2021-10-02  6:32       ` Jean-Christophe Helary
  0 siblings, 1 reply; 13+ messages in thread
From: Ihor Radchenko @ 2021-10-02  6:24 UTC (permalink / raw)
  To: Jean-Christophe Helary; +Cc: Protesilaos Stavrou, emacs-humanities, orgmode

Jean-Christophe Helary <lists@traduction-libre.org> writes:

> My follow-up question is, most of the ox-stuff seem to be installed by default, as far as I can tell. Why is ox-md not ?

Not most. The default export backends are:

> org-export-backends is a variable defined in org.el.
> 
> Value
> (ascii html icalendar latex odt)

You can also customise this variable instead of direct (require 'ox-md)

Why not all backends are loaded? Mostly to reduce Org loading speed that
some people complain about.

Best,
Ihor


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

* Re: Elegant way to export org to Markdown ?
  2021-10-02  6:24     ` Ihor Radchenko
@ 2021-10-02  6:32       ` Jean-Christophe Helary
  2021-10-02  7:00         ` Ihor Radchenko
  0 siblings, 1 reply; 13+ messages in thread
From: Jean-Christophe Helary @ 2021-10-02  6:32 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Protesilaos Stavrou, emacs-humanities, orgmode



> On Oct 2, 2021, at 15:24, Ihor Radchenko <yantar92@gmail.com> wrote:
> 
> Jean-Christophe Helary <lists@traduction-libre.org> writes:
> 
>> My follow-up question is, most of the ox-stuff seem to be installed by default, as far as I can tell. Why is ox-md not ?
> 
> Not most. The default export backends are:
> 
>> org-export-backends is a variable defined in org.el.
>> 
>> Value
>> (ascii html icalendar latex odt)
> 
> You can also customise this variable instead of direct (require 'ox-md)
> 
> Why not all backends are loaded? Mostly to reduce Org loading speed that
> some people complain about.

Also, I could have checked the manual... It was all there... Apologies for the noise.

Next (related) question:

Why that ugly number in front of headers defined with <hn> in HTML ?


-- 
Jean-Christophe Helary @brandelune
https://mac4translators.blogspot.com
https://sr.ht/~brandelune/omegat-as-a-book/



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

* Re: Elegant way to export org to Markdown ?
  2021-10-02  6:32       ` Jean-Christophe Helary
@ 2021-10-02  7:00         ` Ihor Radchenko
  2021-10-02  7:34           ` Jean-Christophe Helary
  0 siblings, 1 reply; 13+ messages in thread
From: Ihor Radchenko @ 2021-10-02  7:00 UTC (permalink / raw)
  To: Jean-Christophe Helary; +Cc: Protesilaos Stavrou, emacs-humanities, orgmode

Jean-Christophe Helary <lists@traduction-libre.org> writes:

> Next (related) question:
>
> Why that ugly number in front of headers defined with <hn> in HTML ?

I have little knowledge about HTML export... I blind guess is that you
may disable org-export-with-section-numbers
(see "14.1.5 Options for the exporters" section of the manual)

As for "ugly", it is probably subjective. Can you share a screenshot and
suggest a concrete improvement?

Also, are you on Org 9.5? I have seen some patches in that area lately.

Best,
Ihor


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

* Re: Elegant way to export org to Markdown ?
  2021-10-02  7:00         ` Ihor Radchenko
@ 2021-10-02  7:34           ` Jean-Christophe Helary
  0 siblings, 0 replies; 13+ messages in thread
From: Jean-Christophe Helary @ 2021-10-02  7:34 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Protesilaos Stavrou, emacs-humanities, orgmode



> On Oct 2, 2021, at 16:00, Ihor Radchenko <yantar92@gmail.com> wrote:
> 
> Jean-Christophe Helary <lists@traduction-libre.org> writes:
> 
>> Next (related) question:
>> 
>> Why that ugly number in front of headers defined with <hn> in HTML ?
> 
> I have little knowledge about HTML export... I blind guess is that you
> may disable org-export-with-section-numbers
> (see "14.1.5 Options for the exporters" section of the manual)

Thank you for the pointer.

> As for "ugly", it is probably subjective.

HTML does not require the addition of a number to indicate the heading level. The exported number is very much unexpected. Numbers (or ordering indicators) are expected in an <ol> context, but nowhere else.

> Can you share a screenshot and
> suggest a concrete improvement?

Disable that by default.

> Also, are you on Org 9.5?

I'm on the latest update in a locally recently built emacs/master.

> I have seen some patches in that area lately.

Thank you for the information.

-- 
Jean-Christophe Helary @brandelune
https://mac4translators.blogspot.com
https://sr.ht/~brandelune/omegat-as-a-book/



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

* Re: Elegant way to export org to Markdown ?
  2021-10-02  5:20 Elegant way to export org to Markdown ? Jean-Christophe Helary
  2021-10-02  5:55 ` Ihor Radchenko
  2021-10-02  5:57 ` Protesilaos Stavrou
@ 2021-10-02  7:44 ` Tim Cross
  2021-10-02  9:10   ` Jean-Christophe Helary
  2021-10-02 12:18 ` Morgan Willcock
  2021-10-03  4:11 ` [emacs-humanities] " Jean-Christophe Helary
  4 siblings, 1 reply; 13+ messages in thread
From: Tim Cross @ 2021-10-02  7:44 UTC (permalink / raw)
  To: emacs-orgmode


Jean-Christophe Helary <lists@traduction-libre.org> writes:

> I'm trying to work with SourceHut (sr.ht) and right now they only accept Markdown syntax for their readme/wiki files.
>
> Since I work in Emacs/org-mode to write my documents (and try to stick to that),
> I'd like to know if there is an elegant way to export org syntax to MarkDown.
>
> I was thinking that the export-dispatch had an option for Plain Text / Markdown, but that doesn't seem to be the case.
>
> As a workaround, I thought I'd work on a README.org file that I export to HTML,
> change the name to .md and edit the contents to reduce the markup to the strict
> minimum... But when I saw the contents of the HTML, I thought that would be way
> too much work.
>
> *BUT* MarkDown bien basically HTML *without* the head/body tags, it seems to me
> that the HTML export-dispatch thing could have a "super simplified MD
> compatible" HTML option...
>
> Either way, I need a method to export to something that sr.ht will recognize and process as MD so:
>
> 1) is there an external "approved" process to convert org-mode syntaxt to an MD-compatible format ?
> 2) if no, what is the not too hard way to hack the HTML output to produce what I need with export-dispatch ?
>

Org does have an exporter for markdown. You need to enable it (see the
manual).

Note that 'markdown' is a somewhat generic term - there is no 'standard'
for markdown. This means that the markdown generated by org may not be
the same syntax as the markdown supported by sourceHut. A similar issue
exists with github and as a result, there is also an external package
which can add github flavoured markdown to org.

If sourceHut markdown is not the same as org's markdown or the github
flavored markdown, it may be necessary to write a sourceHut flavored
markdown exporter (probably fairly easy to do using the existing ox-md
as a starting point). 


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

* Re: Elegant way to export org to Markdown ?
  2021-10-02  7:44 ` Tim Cross
@ 2021-10-02  9:10   ` Jean-Christophe Helary
  0 siblings, 0 replies; 13+ messages in thread
From: Jean-Christophe Helary @ 2021-10-02  9:10 UTC (permalink / raw)
  To: Tim Cross; +Cc: emacs-orgmode



> On Oct 2, 2021, at 16:44, Tim Cross <theophilusx@gmail.com> wrote:
> 
> Jean-Christophe Helary <lists@traduction-libre.org> writes:
> 
>> I'm trying to work with SourceHut (sr.ht) and right now they only accept Markdown syntax for their readme/wiki files.
>> 
>> Since I work in Emacs/org-mode to write my documents (and try to stick to that),
>> I'd like to know if there is an elegant way to export org syntax to MarkDown.

> Org does have an exporter for markdown. You need to enable it (see the
> manual).

That's what I had missed. Thank you.

> Note that 'markdown' is a somewhat generic term - there is no 'standard'
> for markdown.

Well, there is John Gruber's original definition.

-- 
Jean-Christophe Helary @brandelune
https://mac4translators.blogspot.com
https://sr.ht/~brandelune/omegat-as-a-book/



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

* Re: Elegant way to export org to Markdown ?
  2021-10-02  5:20 Elegant way to export org to Markdown ? Jean-Christophe Helary
                   ` (2 preceding siblings ...)
  2021-10-02  7:44 ` Tim Cross
@ 2021-10-02 12:18 ` Morgan Willcock
  2021-10-02 13:31   ` Jean-Christophe Helary
  2021-10-03  4:11 ` [emacs-humanities] " Jean-Christophe Helary
  4 siblings, 1 reply; 13+ messages in thread
From: Morgan Willcock @ 2021-10-02 12:18 UTC (permalink / raw)
  To: Jean-Christophe Helary; +Cc: emacs-humanities, orgmode

Jean-Christophe Helary <lists@traduction-libre.org> writes:

> I'm trying to work with SourceHut (sr.ht) and right now they only accept Markdown syntax for their readme/wiki files.

Hi Jean-Christophe,

If this is just for SourceHut you can use an HTML export and upload it
via the API instead of committing a Markdown based file.

https://man.sr.ht/git.sr.ht/#setting-a-custom-readme

Regards,
Morgan


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

* Re: Elegant way to export org to Markdown ?
  2021-10-02 12:18 ` Morgan Willcock
@ 2021-10-02 13:31   ` Jean-Christophe Helary
  0 siblings, 0 replies; 13+ messages in thread
From: Jean-Christophe Helary @ 2021-10-02 13:31 UTC (permalink / raw)
  To: Morgan Willcock; +Cc: emacs-humanities, orgmode



> On Oct 2, 2021, at 21:18, Morgan Willcock <mwillcock@precedence.co.uk> wrote:
> 
> Jean-Christophe Helary <lists@traduction-libre.org> writes:
> 
>> I'm trying to work with SourceHut (sr.ht) and right now they only accept Markdown syntax for their readme/wiki files.
> 
> Hi Jean-Christophe,
> 
> If this is just for SourceHut you can use an HTML export and upload it
> via the API instead of committing a Markdown based file.
> 
> https://man.sr.ht/git.sr.ht/#setting-a-custom-readme

Morgan,

Thank you for the pointer.

Actually, Noah and Drew suggested that on sr.ht, but I really have *no* idea what an API is, how I work with it, what is the graphql thing and all.

It looks like a super-powerful thing that smart people use, but it will probably take me quite some time before I can actually know where to start with all that info (I did check graphql tutorials but I was like: "ok, and where do I type all that?")...

Besides, org's md export works like a charm.

-- 
Jean-Christophe Helary @brandelune
https://mac4translators.blogspot.com
https://sr.ht/~brandelune/omegat-as-a-book/



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

* Re: [emacs-humanities] Elegant way to export org to Markdown ?
  2021-10-02  5:20 Elegant way to export org to Markdown ? Jean-Christophe Helary
                   ` (3 preceding siblings ...)
  2021-10-02 12:18 ` Morgan Willcock
@ 2021-10-03  4:11 ` Jean-Christophe Helary
  4 siblings, 0 replies; 13+ messages in thread
From: Jean-Christophe Helary @ 2021-10-03  4:11 UTC (permalink / raw)
  To: orgmode; +Cc: emacs-humanities

Better solution found: quit sr.ht and move to a gitea implementation.

No hassle, org files are fully recognized.

Jean-Christophe 

> On Oct 2, 2021, at 14:20, Jean-Christophe Helary <lists@traduction-libre.org> wrote:
> 
> I'm trying to work with SourceHut (sr.ht) and right now they only accept Markdown syntax for their readme/wiki files.
> 
> Since I work in Emacs/org-mode to write my documents (and try to stick to that), I'd like to know if there is an elegant way to export org syntax to MarkDown.
> 
> I was thinking that the export-dispatch had an option for Plain Text / Markdown, but that doesn't seem to be the case.
> 
> As a workaround, I thought I'd work on a README.org file that I export to HTML, change the name to .md and edit the contents to reduce the markup to the strict minimum... But when I saw the contents of the HTML, I thought that would be way too much work.
> 
> *BUT* MarkDown bien basically HTML *without* the head/body tags, it seems to me that the HTML export-dispatch thing could have a "super simplified MD compatible" HTML option...
> 
> Either way, I need a method to export to something that sr.ht will recognize and process as MD so:
> 
> 1) is there an external "approved" process to convert org-mode syntaxt to an MD-compatible format ?
> 2) if no, what is the not too hard way to hack the HTML output to produce what I need with export-dispatch ?
> 
> ---side note--
> And, Hello to Emacs-Humanities! I was away from the emacs-lists for a year and when I came back I found that this amazing list was born. Last year I started a "go-back-to-school" process that will eventually conclude with me finishing an MA in Japanese studies, and I wrote my first 57 pages research report last year with org-mode/Zotero/NeoOffice (a macOS only LibreOffice), and that was fun. This year I work remotely as a part-time lecturer in translation studies where I'll teach how to use free software in translation (OmegaT/Opaki Framework/Maxprograms) and I wanted to write my teaching material in org on sr.ht, but...
> 
> -- 
> Jean-Christophe Helary @brandelune
> https://mac4translators.blogspot.com
> https://sr.ht/~brandelune/omegat-as-a-book/
> 
> 

-- 
Jean-Christophe Helary @brandelune
https://mac4translators.blogspot.com
https://sr.ht/~brandelune/omegat-as-a-book/



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

end of thread, other threads:[~2021-10-03  4:12 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-02  5:20 Elegant way to export org to Markdown ? Jean-Christophe Helary
2021-10-02  5:55 ` Ihor Radchenko
2021-10-02  5:57 ` Protesilaos Stavrou
2021-10-02  6:10   ` Jean-Christophe Helary
2021-10-02  6:24     ` Ihor Radchenko
2021-10-02  6:32       ` Jean-Christophe Helary
2021-10-02  7:00         ` Ihor Radchenko
2021-10-02  7:34           ` Jean-Christophe Helary
2021-10-02  7:44 ` Tim Cross
2021-10-02  9:10   ` Jean-Christophe Helary
2021-10-02 12:18 ` Morgan Willcock
2021-10-02 13:31   ` Jean-Christophe Helary
2021-10-03  4:11 ` [emacs-humanities] " Jean-Christophe Helary

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