From: Ihor Radchenko <yantar92@posteo.net>
To: Rohit Patnaik <quanticle@quanticle.net>
Cc: emacs-orgmode@gnu.org
Subject: Re: How does =org-md-item= produce the correct indentation for nested lists?
Date: Sat, 13 Apr 2024 19:26:00 +0000 [thread overview]
Message-ID: <87a5lxyshj.fsf@localhost> (raw)
In-Reply-To: <bf844ef6-42ed-4001-b761-e0cbfe2b8dec@app.fastmail.com>
"Rohit Patnaik" <quanticle@quanticle.net> writes:
> #+BEGIN_SRC elisp
> (concat bullet
> ...
> (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 code makes use of the CONTENTS.
If you have nested lists
- item
- sub-item
- sub-sub-item
"sub-sub-item" transcoder will receive CONTENTS="sub-sub-item" and return
- sub-sub-item
then, "sub-item" transcoder will receive CONTENTS="sub-item" + output of
nested transcoder -
CONTENTS=
sub-item
- sub-sub-item
and add 4 spaces to each line, except first:
- sub-item
- sub-sub-item
then, item transcoder will receive the result of the two nested
transcoders:
CONTENTS=
item
- sub-item
- sub-sub-item
yielding
- item
- sub-item
- sub-sub-item
Hope, it clarifies things.
--
Ihor Radchenko // yantar92,
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>
next prev parent reply other threads:[~2024-04-13 19:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-13 4:07 How does =org-md-item= produce the correct indentation for nested lists? Rohit Patnaik
2024-04-13 19:26 ` Ihor Radchenko [this message]
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=87a5lxyshj.fsf@localhost \
--to=yantar92@posteo.net \
--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).