Re: How to export to markdown programmatically without the table of contents?

2022-05-08 Thread Marcin Borkowski


On 2022-05-07, at 10:16, Max Nikulin  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



Re: How to export to markdown programmatically without the table of contents?

2022-05-07 Thread Max Nikulin

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.





Re: How to export to markdown programmatically without the table of contents?

2022-05-04 Thread Karl Voit
* Jeremie Juste  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/




Re: How to export to markdown programmatically without the table of contents?

2022-05-03 Thread Daniel Fleischer
Karl Voit  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



Re: How to export to markdown programmatically without the table of contents?

2022-05-03 Thread Jeremie Juste
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



Re: How to export to markdown programmatically without the table of contents?

2022-05-03 Thread Karl Voit
Hi,

* 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))
>>
>>
>> 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/




Re: How to export to markdown programmatically without the table of contents?

2022-05-02 Thread Marcin Borkowski


On 2022-05-01, at 22:01, Berry, Charles  wrote:

>> On May 1, 2022, at 2:20 AM, Marcin Borkowski  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



Re: How to export to markdown programmatically without the table of contents?

2022-05-02 Thread Daniel Fleischer
Jeremie Juste [2022-05-01 Sun 22:29] wrote:

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

That's a good resource!




Re: How to export to markdown programmatically without the table of contents?

2022-05-01 Thread Jeremie Juste
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



Re: How to export to markdown programmatically without the table of contents?

2022-05-01 Thread Berry, Charles



> On May 1, 2022, at 2:20 AM, Marcin Borkowski  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






Re: How to export to markdown programmatically without the table of contents?

2022-05-01 Thread Jeremie Juste
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




How to export to markdown programmatically without the table of contents?

2022-05-01 Thread Marcin Borkowski
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