From: "Tom Alexander" <tom@fizz.buzz>
To: emacs-orgmode@gnu.org
Subject: Inconsistent text markup handling when double-nesting markers
Date: Mon, 09 Oct 2023 19:02:18 -0400 [thread overview]
Message-ID: <dad964f5-c764-4dd5-9829-ca38e3fbeb0d@app.fastmail.com> (raw)
I used the following test document:
```
__foo__
**foo**
```
I'd expect the two to behave the same but the first one parses as:
```
(paragraph
"_"
(subscript "foo")
"__"
)
```
Whereas the second parses as:
```
(paragraph
(bold
(bold
"foo"
)
)
)
```
This pattern happens in worg at [2]
Looking at the description for text markup in the syntax document[1], I don't see any reason the first wouldn't be parsed as an underline:
1. PRE: valid because it is the beginning of a line
2. MARKER: valid underscore
3. CONTENTS: valid. Series of objects from standard set includes both subscript and text markup, so regardless of how we parse the interior, its valid. Also cannot begin or end with whitespace but there is no whitespace in the CONTENTS.
4. MARKER: valid underscore
5. POST: Only valid if we extend the underline to the 2nd underscore so it ends at the end of the line. But the 2nd line shows us that having copies of the marker inside the CONTENTS is fine so I see two possible expected parses of the CONTENTS:
4a. (underline "foo")
4b. ((subscript "foo") (plain-text "_"))
I also ran the following test document to further prove that having copies of the marker inside the CONTENTS is fine:
```
*foo*bar*
```
which parses as (bold "foo*bar")
So the only way the top line would fail to parse as an underline is if it matched the first closing underscore as closing the underline, but that would be invalid because underscore is not a valid POST character and invalid copies of the closing marker are ignored as proven by both "**foo**" and "*foo*bar*".
[1] https://orgmode.org/worg/org-syntax.html#Emphasis_Markers
[2] https://git.sr.ht/~bzg/worg/tree/ba6cda890f200d428a5d68e819eef15b5306055f/org-contrib/babel/intro.org#L117
--
Tom Alexander
pgp: https://fizz.buzz/pgp.asc
next reply other threads:[~2023-10-09 23:03 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-09 23:02 Tom Alexander [this message]
2023-10-10 12:07 ` Inconsistent text markup handling when double-nesting markers Ihor Radchenko
2023-10-11 2:23 ` Max Nikulin
2023-10-11 9:15 ` Ihor Radchenko
2023-10-11 12:16 ` Max Nikulin
2023-10-11 12:26 ` Ihor Radchenko
2023-10-11 14:40 ` Tom Alexander
2023-10-12 10:23 ` Max Nikulin
2023-10-12 12:04 ` Ihor Radchenko
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=dad964f5-c764-4dd5-9829-ca38e3fbeb0d@app.fastmail.com \
--to=tom@fizz.buzz \
--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).