emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@gmail.com>
To: Rohit Patnaik <quanticle@quanticle.net>
Cc: emacs-orgmode@gnu.org
Subject: Re: [Feature Request] Create an org-md-toplevel-hlevel variable to allow users to set the level of top level headings in markdown export
Date: Mon, 22 Aug 2022 10:59:23 +0800	[thread overview]
Message-ID: <875yilkmpg.fsf@localhost> (raw)
In-Reply-To: <b888e23b-67f5-45d6-9160-f1551f40de35@www.fastmail.com>

"Rohit Patnaik" <quanticle@quanticle.net> writes:

>> This contribution will be welcome.
>
> I've attached a patch which implements the change. I followed the pattern that
> ox-html uses to the greatest extent possible. I tested it by exporting org-mode
> files to markdown with the table of contents both enabled and disabled. I
> didn't see any errors, and I was able to make the top level heading a level 2
> (or even level 3) heading rather than level 1.

Thanks for your contribution!
Please also add the NEWS entry and an item to "14.1.5 Options for the
exporters" section of the manual.

> Subject: [PATCH] Added top level header setting for md export
>
> This commit adds a customization, org-md-toplevel-hlevel, which sets the
> heading level of top-level headings in the exported markdown. This makes
> markdown export behave more like HTML export, which reads
> org-html-toplevel-hlevel to decide what the top level heading for HTML
> export should be.

Please follow the changelog style as described in
https://orgmode.org/worg/org-contribute.html#commit-messages

> +(defcustom org-md-toplevel-hlevel 1
> +  "The markdown heading level to use for level 1 headings in markdown export.
> +If this is 1, the top level headings will be level 1 markdown headings. If this
> +is 2, then top level headings will be level 2 markdown headings. By default 
> +this is 1, so that org-mode headings correspond to the same level markdown
> +headings. Incrementing this value may be helpful creating markdown for 
> +inclusion in another document or application that reserves top-level headings
> +for its own use."
> +  :group 'org-export-md
> +  :type 'string)

Please follow the recommended documentation style: double space between
sentences, 80 chars fill.
See "D.6 Tips for Documentation Strings" section of Elisp manual.

-- 
Ihor Radchenko,
Org mode contributor,
Learn more about Org mode at https://orgmode.org/.
Support Org development at https://liberapay.com/org-mode,
or support my work at https://liberapay.com/yantar92


  parent reply	other threads:[~2022-08-22  2:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-19 20:20 [Feature Request] Create an org-md-toplevel-hlevel variable to allow users to set the level of top level headings in markdown export Rohit Patnaik
2022-08-20  7:49 ` Ihor Radchenko
2022-08-21 11:07   ` Rohit Patnaik
2022-08-21 14:26     ` Max Nikulin
     [not found]       ` <47b3902e-cc80-4317-a761-9301abd50b3c@www.fastmail.com>
2022-08-22 12:03         ` Max Nikulin
2022-08-22  2:59     ` Ihor Radchenko [this message]
     [not found]       ` <1335376b-0eeb-472c-8b8d-988eb0bdd04b@www.fastmail.com>
2022-08-26 13:07         ` Ihor Radchenko
2022-08-26 15:34           ` Rohit Patnaik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=875yilkmpg.fsf@localhost \
    --to=yantar92@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=quanticle@quanticle.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).