From: "Rohit Patnaik" <quanticle@quanticle.net>
To: emacs-orgmode@gnu.org
Subject: How does =org-md-item= produce the correct indentation for nested lists?
Date: Fri, 12 Apr 2024 23:07:13 -0500 [thread overview]
Message-ID: <bf844ef6-42ed-4001-b761-e0cbfe2b8dec@app.fastmail.com> (raw)
Hello,
I was looking at the implementation for =org-md-item=, in ox-md.el, and I'm
wondering how indentation logic for nested lists works. Specifically, I was
looking at the following code:
#+BEGIN_SRC elisp
(concat bullet
(make-string (- 4 (length bullet)) ? )
(pcase (org-element-property :checkbox item)
(`on "[X] ")
(`trans "[-] ")
(`off "[ ] "))
(let ((tag (org-element-property :tag item)))
(and tag (format "**%s:** "(org-export-data tag info))))
(and contents
(org-trim (replace-regexp-in-string "^" " " contents))))
#+END_SRC
and I'm wondering why it's adding indentation in front of the bullet. Naively, I
would expect the result of this snippet, for an unordered list to be something
like:
=- [item contents]=
That is, it concatenate the bullet, then three spaces (4 - length of bullet),
then another four spaces, then the contents of the item. Instead, what I see is
a four-space indent, followed by the bullet and its padding, followed by the
item contents:
= - [item contents]=
This is the correct result, but I don't see how the code from ox-md.el produces
that result.
The reason I'm asking is because I have similar logic in the org-mode exporter
I'm writing for PMWiki markup:
https://github.com/quanticle/ox-pmwiki/blob/master/ox-pmwiki.el#L214
and I would like to change the logic so that instead of indenting with spaces,
it repeats the list marker (** for a second level nested list, *** for 3 levels
of nesting, etc).
Thanks,
Rohit Patnaik
next reply other threads:[~2024-04-13 4:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-13 4:07 Rohit Patnaik [this message]
2024-04-13 19:26 ` How does =org-md-item= produce the correct indentation for nested lists? Ihor Radchenko
2024-04-14 5:51 ` 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=bf844ef6-42ed-4001-b761-e0cbfe2b8dec@app.fastmail.com \
--to=quanticle@quanticle.net \
--cc=emacs-orgmode@gnu.org \
/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).