emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* inline-special-block: part2
@ 2024-04-11 10:49 Max Nikulin
  2024-04-11 11:03 ` Verbatim content (inline-special-block) Max Nikulin
  2024-04-11 11:08 ` Link to the repository (Re: inline-special-block: part2) Max Nikulin
  0 siblings, 2 replies; 6+ messages in thread
From: Max Nikulin @ 2024-04-11 10:49 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Juan Manuel Macías

I think, it is better to create a new thread to discuss next bunch of 
questions related to the inline special block feature.

Previous thread is rather huge:

Juan Manuel Macías. Experimental public branch for inline special 
blocks. Fri, 01 Mar 2024 20:34:35 +0000.
https:list.orgmode.org/87wmql6690.fsf@posteo.net

In particular it contains detailed overview

Ihor Radchenko. Re: Experimental public branch for inline special 
blocks. Tue, 09 Apr 2024 08:52:38 +0000.
https://list.orgmode.org/875xwqj4tl.fsf@localhost

An earlier closely related thread:

Juan Manuel Macías. [proof of concept] inline language blocks. Tue, 20 
Feb 2024 20:35:04 +0000.
https://list.orgmode.org/87msrudgcn.fsf@posteo.net


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Verbatim content (inline-special-block)
  2024-04-11 10:49 inline-special-block: part2 Max Nikulin
@ 2024-04-11 11:03 ` Max Nikulin
  2024-04-11 12:58   ` Ihor Radchenko
  2024-04-11 11:08 ` Link to the repository (Re: inline-special-block: part2) Max Nikulin
  1 sibling, 1 reply; 6+ messages in thread
From: Max Nikulin @ 2024-04-11 11:03 UTC (permalink / raw)
  To: emacs-orgmode

Ihor Radchenko. Re: Experimental public branch for inline special
blocks. Tue, 09 Apr 2024 08:52:38 +0000.
https://list.orgmode.org/875xwqj4tl.fsf@localhost

>     - We should be able to define special markup for code, where the
>       contents is not parsed. Something like
> 
>       @code{ unlike =code=, we can have leading and trailing spaces }
>       @code{ @foo{is not interpreted inside}}

I think, it should be controlled by some optional parameter like

     @kbd[:verbatim t]{ unlike =code=, ... }

Certainly parsing of normal Org markup should be suppressed,
however I am less sure concerning @markup{}. In the following example 
text inside @param{} may be emphasized:

     @code{def calculate(@param{expr}, @param{env})}

"@" inside such object may be escaped as @{@}. An alternatively is a 
parameter like :parse that can have values like "markup", "custom", 
"verbatim". This case "verbatim" disabled parsing of @objects().


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Link to the repository (Re: inline-special-block: part2)
  2024-04-11 10:49 inline-special-block: part2 Max Nikulin
  2024-04-11 11:03 ` Verbatim content (inline-special-block) Max Nikulin
@ 2024-04-11 11:08 ` Max Nikulin
  1 sibling, 0 replies; 6+ messages in thread
From: Max Nikulin @ 2024-04-11 11:08 UTC (permalink / raw)
  To: emacs-orgmode

On 11/04/2024 17:49, Max Nikulin wrote:
> I think, it is better to create a new thread to discuss next bunch of 
> questions related to the inline special block feature.

I have realized that I forgot to add the link for those who wish to try 
the new feature in action:

Juan Manuel Macías. Experimental public branch for inline special 
blocks. Fri, 01 Mar 2024 20:34:35 +0000.
https:list.orgmode.org/87wmql6690.fsf@posteo.net
> 
> Finally, I have made public on GitLab my experimental branch for the new
> (possible) inline-special-block element:
> 
> <https://gitlab.com/maciaschain/org-mode.git>





^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Verbatim content (inline-special-block)
  2024-04-11 11:03 ` Verbatim content (inline-special-block) Max Nikulin
@ 2024-04-11 12:58   ` Ihor Radchenko
  2024-04-12 10:55     ` Max Nikulin
  0 siblings, 1 reply; 6+ messages in thread
From: Ihor Radchenko @ 2024-04-11 12:58 UTC (permalink / raw)
  To: Max Nikulin; +Cc: emacs-orgmode

Max Nikulin <manikulin@gmail.com> writes:

>>     - We should be able to define special markup for code, where the
>>       contents is not parsed. Something like
>> 
>>       @code{ unlike =code=, we can have leading and trailing spaces }
>>       @code{ @foo{is not interpreted inside}}
>
> I think, it should be controlled by some optional parameter like
>
>      @kbd[:verbatim t]{ unlike =code=, ... }

I do not like this idea - this will make the attribute list a part of
the Org markup spec, which I would like to avoid if possible:

1. External parsers would be forced to understand the attribute syntax,
   which will complicate Org markup spec.
2. Our own parser may have to account for attribute inheritance while
   parsing, which will complicate the parser too much.

The question remains how to define custom verbatim markup, of course.

It may be enough to have @kbd{@code{...}} - it is not like Texinfo has a
concept of truly verbatim text like in Org.

Alternatively, we may allow two classes of inline markup:
@foo{parsed *text* inside}
and
@foo={verbatim *text* inside}/@foo~{verbatim *text* inside}

This way, instead of @code{}, we should use @code~{...} or even
@~{...}/@={...} (mnemonics for ~...~ and =...=)

> Certainly parsing of normal Org markup should be suppressed,
> however I am less sure concerning @markup{}. In the following example 
> text inside @param{} may be emphasized:
>
>      @code{def calculate(@param{expr}, @param{env})}
>
> "@" inside such object may be escaped as @{@}. An alternatively is a 
> parameter like :parse that can have values like "markup", "custom", 
> "verbatim". This case "verbatim" disabled parsing of @objects().

AFAIU, you are referring to how Texinfo handles its @code{...} command,
where other texinfo commands are allowed, which is _conceptually_
different from how Org handles the verbatim/code - as a general rule,
all the "code" in Org mode syntax is taken verbatim (with the only
exception of src blocks where we have no choice).

Also, the reason why Texinfo users do @param in @code is the lack of
automatic syntax highlighting, unlike in Org mode.

I think that Org mode's equivalent of Texinfo @code should be either

1. inline src block
2. if direct markup is unavoidable, use something like
   @fixedwidth{@code{def calculate(}@param{expr}@code{, }@param{env}@code{)}}
   Most of the @code{..} can be safely dropped. It is just to illustrate
   the idea that we still parse the contents.

   In practice, things like
   *def* calculate(expr, env) "foo\alpha"
   will become
   @fixedwidth{*def@code{*} calculate(@param{expr}, @param{env}) "foo@code{\}alpha"}
   or
   @fixedwidth{\star{}def* calculate(@param{expr}, @param{env}) "foo\@@{}alpha"}

-- 
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>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Verbatim content (inline-special-block)
  2024-04-11 12:58   ` Ihor Radchenko
@ 2024-04-12 10:55     ` Max Nikulin
  2024-04-12 17:53       ` Ihor Radchenko
  0 siblings, 1 reply; 6+ messages in thread
From: Max Nikulin @ 2024-04-12 10:55 UTC (permalink / raw)
  To: emacs-orgmode

On 11/04/2024 19:58, Ihor Radchenko wrote:
> Max Nikulin writes:
>>>        @code{ unlike =code=, we can have leading and trailing spaces }
>>>        @code{ @foo{is not interpreted inside}}
>>
>> I think, it should be controlled by some optional parameter like
>>
>>       @kbd[:verbatim t]{ unlike =code=, ... }
> 
> I do not like this idea - this will make the attribute list a part of
> the Org markup spec,

I see you point and I agree that it is valid concern. On the other hand 
I do not have strong opinion what variant is better.

> It may be enough to have @kbd{@code{...}} - it is not like Texinfo has a
> concept of truly verbatim text like in Org.
> 
> Alternatively, we may allow two classes of inline markup:
> @foo{parsed *text* inside}
> and
> @foo={verbatim *text* inside}/@foo~{verbatim *text* inside}
> 
> This way, instead of @code{}, we should use @code~{...} or even
> @~{...}/@={...} (mnemonics for ~...~ and =...=)

I consider @foo={}-like variants as unnecessary complications of the 
inline special block feature. The idea of composition is better from my 
point of view. With this approach it is enough to have non-conflicting 
syntax for non-parsed fragments. I am against making @code{} a special 
name with suppressed markup parsing. The price of composition in 
comparison with @foo={} is more verbose markup.

By the way, Org has src_lang{...} syntax for almost non-parsed fragments 
(neglecting requirement of balanced curly brackets that is an issue).

Actually "=" in @foo={} is a kind of special argument distinct from ones 
specified inside [] and {}.

>>       @code{def calculate(@param{expr}, @param{env})}
[...]
> Also, the reason why Texinfo users do @param in @code is the lack of
> automatic syntax highlighting, unlike in Org mode.

Is ox-texinfo able to convert syntax highlighting to native texinfo markup?

So if @markup{} is not allowed in verbatim content then it is another 
feature loosely related to custom inline blocks.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Verbatim content (inline-special-block)
  2024-04-12 10:55     ` Max Nikulin
@ 2024-04-12 17:53       ` Ihor Radchenko
  0 siblings, 0 replies; 6+ messages in thread
From: Ihor Radchenko @ 2024-04-12 17:53 UTC (permalink / raw)
  To: Max Nikulin; +Cc: emacs-orgmode

Max Nikulin <manikulin@gmail.com> writes:

>> It may be enough to have @kbd{@code{...}} - it is not like Texinfo has a
>> concept of truly verbatim text like in Org.
>> 
>> Alternatively, we may allow two classes of inline markup:
>> @foo{parsed *text* inside}
>> and
>> @foo={verbatim *text* inside}/@foo~{verbatim *text* inside}
>> 
>> This way, instead of @code{}, we should use @code~{...} or even
>> @~{...}/@={...} (mnemonics for ~...~ and =...=)
>
> I consider @foo={}-like variants as unnecessary complications of the 
> inline special block feature. The idea of composition is better from my 
> point of view. With this approach it is enough to have non-conflicting 
> syntax for non-parsed fragments. I am against making @code{} a special 
> name with suppressed markup parsing. The price of composition in 
> comparison with @foo={} is more verbose markup.

Then, do you have an idea about such syntax?

One option I thought of was making @foo{=...=} a special type of boundary
delimiting non-parsing contents. However, it is not very elegant IMHO.

> By the way, Org has src_lang{...} syntax for almost non-parsed fragments 
> (neglecting requirement of balanced curly brackets that is an issue).

Yes, but it is handled differently by exporters from =verbatim=/~code~.
In fact, even the idea with @foo{@code{...}} may be problematic in this
regard - @code{...} inside, if we treat it as an equivalent of ~code~,
may be problematic if some export backends do something unusual about
code markup.

> Actually "=" in @foo={} is a kind of special argument distinct from ones 
> specified inside [] and {}.

Yes, but it is much easier to parse. If we use a proper attribute, we
run into all kind of issues with how consistent it should be with the
parsing rules for other attributes (should it be inherited? may it
appear in arbitrary place in [...]?). And if we make it special, we will
run in various special cases in the parser...

>>>       @code{def calculate(@param{expr}, @param{env})}
> [...]
>> Also, the reason why Texinfo users do @param in @code is the lack of
>> automatic syntax highlighting, unlike in Org mode.
>
> Is ox-texinfo able to convert syntax highlighting to native texinfo markup?

No.

> So if @markup{} is not allowed in verbatim content then it is another 
> feature loosely related to custom inline blocks.

May you elaborate?

-- 
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>


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-04-12 17:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-11 10:49 inline-special-block: part2 Max Nikulin
2024-04-11 11:03 ` Verbatim content (inline-special-block) Max Nikulin
2024-04-11 12:58   ` Ihor Radchenko
2024-04-12 10:55     ` Max Nikulin
2024-04-12 17:53       ` Ihor Radchenko
2024-04-11 11:08 ` Link to the repository (Re: inline-special-block: part2) Max Nikulin

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).