emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* How to export to markdown programmatically without the table of contents?
@ 2022-05-01  9:20 Marcin Borkowski
  2022-05-01 19:59 ` Jeremie Juste
  2022-05-01 20:01 ` Berry, Charles
  0 siblings, 2 replies; 12+ messages in thread
From: Marcin Borkowski @ 2022-05-01  9:20 UTC (permalink / raw)
  To: Org-Mode mailing list

Hi fellow Orgers,

I'd like to export a Org-mode formatted string to markdown, but without
the table of contents.

(org-export-string-as my-string 'md t '(toc nil))

didn't work (the ToC was still there).  What am I missing?

TIA,

-- 
Marcin Borkowski
http://mbork.pl


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

* Re: How to export to markdown programmatically without the table of contents?
  2022-05-01  9:20 How to export to markdown programmatically without the table of contents? Marcin Borkowski
@ 2022-05-01 19:59 ` Jeremie Juste
  2022-05-01 20:01 ` Berry, Charles
  1 sibling, 0 replies; 12+ messages in thread
From: Jeremie Juste @ 2022-05-01 19:59 UTC (permalink / raw)
  To: Marcin Borkowski; +Cc: Org-Mode mailing list

Hello Marcin,

On Sunday,  1 May 2022 at 11:20, Marcin Borkowski wrote:

| Optional argument EXT-PLIST, when provided, is a property list
| with external parameters overriding Org default settings, but
| still inferior to file-local settings.

Sorry I don't fully understand what doc means by overriding the Org
default settings.

However I the toc can be removed in this way. 

(org-export-string-as "#+OPTIONS: toc:nil \n\n* test\n1"
'md)

HTH,
Jeremie Juste



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

* Re: How to export to markdown programmatically without the table of contents?
  2022-05-01  9:20 How to export to markdown programmatically without the table of contents? Marcin Borkowski
  2022-05-01 19:59 ` Jeremie Juste
@ 2022-05-01 20:01 ` Berry, Charles
  2022-05-01 20:29   ` Jeremie Juste
  2022-05-02 16:52   ` Marcin Borkowski
  1 sibling, 2 replies; 12+ messages in thread
From: Berry, Charles @ 2022-05-01 20:01 UTC (permalink / raw)
  To: Marcin Borkowski; +Cc: Org-Mode mailing list



> On May 1, 2022, at 2:20 AM, Marcin Borkowski <mbork@mbork.pl> wrote:
> 
> Hi fellow Orgers,
> 
> I'd like to export a Org-mode formatted string to markdown, but without
> the table of contents.
> 
> (org-export-string-as my-string 'md t '(toc nil))
> 
> didn't work (the ToC was still there).  What am I missing?


It does seem odd that BODY-ONLY as `t' gives a toc. With latex it does not regardless of `:with-toc'.

: (org-export-string-as my-string 'md t '(:with-toc nil))

seems to give what you want.

HTH,
Chuck





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

* Re: How to export to markdown programmatically without the table of contents?
  2022-05-01 20:01 ` Berry, Charles
@ 2022-05-01 20:29   ` Jeremie Juste
  2022-05-02  6:06     ` Daniel Fleischer
  2022-05-02 16:52   ` Marcin Borkowski
  1 sibling, 1 reply; 12+ messages in thread
From: Jeremie Juste @ 2022-05-01 20:29 UTC (permalink / raw)
  To: Berry, Charles; +Cc: Org-Mode mailing list

Hello Chuck,

> On Sunday,  1 May 2022 at 20:01, Berry, Charles wrote:
> It does seem odd that BODY-ONLY as `t' gives a toc. With latex it does not regardless of `:with-toc'.
>
> : (org-export-string-as my-string 'md t '(:with-toc nil))
>
> seems to give what you want.

Many thanks for the insights.

I know where to look now:

(info "(org) Publishing options")

Best regards,
Jeremie


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

* Re: How to export to markdown programmatically without the table of contents?
  2022-05-01 20:29   ` Jeremie Juste
@ 2022-05-02  6:06     ` Daniel Fleischer
  0 siblings, 0 replies; 12+ messages in thread
From: Daniel Fleischer @ 2022-05-02  6:06 UTC (permalink / raw)
  To: Jeremie Juste; +Cc: Berry, Charles, Org-Mode mailing list

Jeremie Juste [2022-05-01 Sun 22:29] wrote:

> I know where to look now:
>
> (info "(org) Publishing options")

That's a good resource!



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

* Re: How to export to markdown programmatically without the table of contents?
  2022-05-01 20:01 ` Berry, Charles
  2022-05-01 20:29   ` Jeremie Juste
@ 2022-05-02 16:52   ` Marcin Borkowski
  2022-05-03  9:15     ` Karl Voit
  2022-05-07  8:16     ` Max Nikulin
  1 sibling, 2 replies; 12+ messages in thread
From: Marcin Borkowski @ 2022-05-02 16:52 UTC (permalink / raw)
  To: Berry, Charles; +Cc: Org-Mode mailing list


On 2022-05-01, at 22:01, Berry, Charles <ccberry@health.ucsd.edu> wrote:

>> On May 1, 2022, at 2:20 AM, Marcin Borkowski <mbork@mbork.pl> wrote:
>> 
>> Hi fellow Orgers,
>> 
>> I'd like to export a Org-mode formatted string to markdown, but without
>> the table of contents.
>> 
>> (org-export-string-as my-string 'md t '(toc nil))
>> 
>> didn't work (the ToC was still there).  What am I missing?
>
>
> It does seem odd that BODY-ONLY as `t' gives a toc. With latex it does not regardless of `:with-toc'.
>
> : (org-export-string-as my-string 'md t '(:with-toc nil))
>
> seems to give what you want.

Thanks!

http://mbork.pl/2021-05-02_Org-mode_to_Markdown_via_the_clipboard

Best,

-- 
Marcin Borkowski
http://mbork.pl


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

* Re: How to export to markdown programmatically without the table of contents?
  2022-05-02 16:52   ` Marcin Borkowski
@ 2022-05-03  9:15     ` Karl Voit
  2022-05-03 21:02       ` Jeremie Juste
  2022-05-04  4:13       ` Daniel Fleischer
  2022-05-07  8:16     ` Max Nikulin
  1 sibling, 2 replies; 12+ messages in thread
From: Karl Voit @ 2022-05-03  9:15 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

* Marcin Borkowski <mbork@mbork.pl> wrote:
>
> On 2022-05-01, at 22:01, Berry, Charles <ccberry@health.ucsd.edu> wrote:
>
>>> On May 1, 2022, at 2:20 AM, Marcin Borkowski <mbork@mbork.pl> wrote:
>>> 
>>> I'd like to export a Org-mode formatted string to markdown, but without
>>> the table of contents.
>>> 
>>> (org-export-string-as my-string 'md t '(toc nil))
>>
>>
>> It does seem odd that BODY-ONLY as `t' gives a toc. With latex it does not regardless of `:with-toc'.
>> : (org-export-string-as my-string 'md t '(:with-toc nil))
>> seems to give what you want.
>
> http://mbork.pl/2021-05-02_Org-mode_to_Markdown_via_the_clipboard

I tried this neat code snippet today with Emacs 26.3 and Org-mode
9.1.9 and I got an error:

| org-export-barf-if-invalid-backend: Unknown "nil" back-end: Aborting export

When I execute the following code, I get the same error:
| (setq region "/foo/ *bar* https://example.com baz")
| (org-export-string-as region 'md t '(:with-toc nil))

Could it be that I don't have "md" as backend somehow? Is there a
hidden requirement?

Do I need something like "(require 'ox-md)"? I somehow noted that
those export requirements are not necessary any more. Maybe this is
wrong?

Thanks!

-- 
get mail|git|SVN|photos|postings|SMS|phonecalls|RSS|CSV|XML into Org-mode:
       > get Memacs from https://github.com/novoid/Memacs <
Personal Information Management > http://Karl-Voit.at/tags/pim/
Emacs-related > http://Karl-Voit.at/tags/emacs/



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

* Re: How to export to markdown programmatically without the table of contents?
  2022-05-03  9:15     ` Karl Voit
@ 2022-05-03 21:02       ` Jeremie Juste
  2022-05-04 11:45         ` Karl Voit
  2022-05-04  4:13       ` Daniel Fleischer
  1 sibling, 1 reply; 12+ messages in thread
From: Jeremie Juste @ 2022-05-03 21:02 UTC (permalink / raw)
  To: Karl Voit; +Cc: emacs-orgmode, Karl Voit

Hello Karl,

On Tuesday,  3 May 2022 at 11:15, Karl Voit wrote:
>
> I tried this neat code snippet today with Emacs 26.3 and Org-mode
> 9.1.9 and I got an error:
>
> | org-export-barf-if-invalid-backend: Unknown "nil" back-end: Aborting export
>
> When I execute the following code, I get the same error:
> | (setq region "/foo/ *bar* https://example.com baz")
> | (org-export-string-as region 'md t '(:with-toc nil))
>
> Could it be that I don't have "md" as backend somehow? Is there a
> hidden requirement?

with
$ emacs -Q -L ./lisp -l org /tmp/test.org

then C-c C-e, I don't have markdown in the default export options.

tested with, Org mode version 9.5.3 (release_9.5.3-467-g2bd34e @
/home/djj/src/org-mode/lisp/).

And I still work with (require 'ox-md).

Best regards,
Jeremie


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

* Re: How to export to markdown programmatically without the table of contents?
  2022-05-03  9:15     ` Karl Voit
  2022-05-03 21:02       ` Jeremie Juste
@ 2022-05-04  4:13       ` Daniel Fleischer
  1 sibling, 0 replies; 12+ messages in thread
From: Daniel Fleischer @ 2022-05-04  4:13 UTC (permalink / raw)
  To: Karl Voit; +Cc: emacs-orgmode, Karl Voit

Karl Voit <devnull@Karl-Voit.at> writes:

> Could it be that I don't have "md" as backend somehow? Is there a
> hidden requirement?

The variable `org-export-backends` default value is  

    '(ascii html icalendar latex odt) 

so you need to add 'md. 

-- 

Daniel Fleischer


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

* Re: How to export to markdown programmatically without the table of contents?
  2022-05-03 21:02       ` Jeremie Juste
@ 2022-05-04 11:45         ` Karl Voit
  0 siblings, 0 replies; 12+ messages in thread
From: Karl Voit @ 2022-05-04 11:45 UTC (permalink / raw)
  To: emacs-orgmode

* Jeremie Juste <jeremiejuste@gmail.com> wrote:
> Hello Karl,

Hi Jeremie,

> On Tuesday,  3 May 2022 at 11:15, Karl Voit wrote:
>>
>> I tried this neat code snippet today with Emacs 26.3 and Org-mode
>> 9.1.9 and I got an error:
>>
>> | org-export-barf-if-invalid-backend: Unknown "nil" back-end: Aborting export
>>
>> When I execute the following code, I get the same error:
>> | (setq region "/foo/ *bar* https://example.com baz")
>> | (org-export-string-as region 'md t '(:with-toc nil))
>>
>> Could it be that I don't have "md" as backend somehow? Is there a
>> hidden requirement?
>
> And I still work with (require 'ox-md).

Unfortunately, I did not write down why I thought this is not
necessary any more. However, with the require statement, the error
is gone and the function works now.

Thanks!

-- 
get mail|git|SVN|photos|postings|SMS|phonecalls|RSS|CSV|XML into Org-mode:
       > get Memacs from https://github.com/novoid/Memacs <
Personal Information Management > http://Karl-Voit.at/tags/pim/
Emacs-related > http://Karl-Voit.at/tags/emacs/



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

* Re: How to export to markdown programmatically without the table of contents?
  2022-05-02 16:52   ` Marcin Borkowski
  2022-05-03  9:15     ` Karl Voit
@ 2022-05-07  8:16     ` Max Nikulin
  2022-05-08  6:24       ` Marcin Borkowski
  1 sibling, 1 reply; 12+ messages in thread
From: Max Nikulin @ 2022-05-07  8:16 UTC (permalink / raw)
  To: emacs-orgmode

On 02/05/2022 23:52, Marcin Borkowski wrote:
> On 2022-05-01, at 22:01, Berry, Charles wrote:
>>> On May 1, 2022, at 2:20 AM, Marcin Borkowski wrote:
>>>
>>> I'd like to export a Org-mode formatted string to markdown, but without
>>> the table of contents.
>>>
>>> (org-export-string-as my-string 'md t '(toc nil))
>>>
>>> didn't work (the ToC was still there).  What am I missing?
>>
>> It does seem odd that BODY-ONLY as `t' gives a toc. With latex it does not regardless of `:with-toc'.
>>
>> : (org-export-string-as my-string 'md t '(:with-toc nil))
> 
> Thanks!
> 
> http://mbork.pl/2021-05-02_Org-mode_to_Markdown_via_the_clipboard

The following links posted earlier to this mail list might be 
interesting for you since they are related to "exporting" of org text to 
other applications:

https://github.com/tecosaur/emacs-everywhere
System-wide popup Emacs windows for quick edits

https://github.com/jkitchin/ox-clip/
Copy formatted content from org-mode

The latter copies HTML, not markdown though.




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

* Re: How to export to markdown programmatically without the table of contents?
  2022-05-07  8:16     ` Max Nikulin
@ 2022-05-08  6:24       ` Marcin Borkowski
  0 siblings, 0 replies; 12+ messages in thread
From: Marcin Borkowski @ 2022-05-08  6:24 UTC (permalink / raw)
  To: Max Nikulin; +Cc: emacs-orgmode


On 2022-05-07, at 10:16, Max Nikulin <manikulin@gmail.com> wrote:

> On 02/05/2022 23:52, Marcin Borkowski wrote:
>> On 2022-05-01, at 22:01, Berry, Charles wrote:
>>>> On May 1, 2022, at 2:20 AM, Marcin Borkowski wrote:
>>>>
>>>> I'd like to export a Org-mode formatted string to markdown, but without
>>>> the table of contents.
>>>>
>>>> (org-export-string-as my-string 'md t '(toc nil))
>>>>
>>>> didn't work (the ToC was still there).  What am I missing?
>>>
>>> It does seem odd that BODY-ONLY as `t' gives a toc. With latex it does not regardless of `:with-toc'.
>>>
>>> : (org-export-string-as my-string 'md t '(:with-toc nil))
>> Thanks!
>> http://mbork.pl/2021-05-02_Org-mode_to_Markdown_via_the_clipboard
>
> The following links posted earlier to this mail list might be
> interesting for you since they are related to "exporting" of org text
> to other applications:
>
> https://github.com/tecosaur/emacs-everywhere
> System-wide popup Emacs windows for quick edits
>
> https://github.com/jkitchin/ox-clip/
> Copy formatted content from org-mode
>
> The latter copies HTML, not markdown though.

Thanks, both look really interesting!

-- 
Marcin Borkowski
http://mbork.pl


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

end of thread, other threads:[~2022-05-08  6:27 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-01  9:20 How to export to markdown programmatically without the table of contents? Marcin Borkowski
2022-05-01 19:59 ` Jeremie Juste
2022-05-01 20:01 ` Berry, Charles
2022-05-01 20:29   ` Jeremie Juste
2022-05-02  6:06     ` Daniel Fleischer
2022-05-02 16:52   ` Marcin Borkowski
2022-05-03  9:15     ` Karl Voit
2022-05-03 21:02       ` Jeremie Juste
2022-05-04 11:45         ` Karl Voit
2022-05-04  4:13       ` Daniel Fleischer
2022-05-07  8:16     ` Max Nikulin
2022-05-08  6:24       ` Marcin Borkowski

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