-
Notifications
You must be signed in to change notification settings - Fork 16
Description
I'm opening this issue as discussion instead of suggestion because it is incomplete proposal. I want to share some idea to implement inline macro.
I know, it smells like LaTeX.
Idea
Inline macro syntax needs macro identifier and list of arguments.
We already have good way to represent key-value arguments inline with attached modifier extensions; (key value;key;key). So we only need syntax to represent macro identifier.
In v1 spec, escaped normal character (not whitespace nor punctuation) doesn't have any additional meanings.
We can use that.
\macro-name(key value;params)
As some inline macros might need raw markup text as an argument, we an provide that with existing [...] grammar:
\macro-name[*markup* argument](key value;params)
I'm not sure if
[...]should be free-form or not.If it is free-form, we can replace
$...$syntax with this:\latex[c = \sqrt{a^2 + b^2}] \typst[c = sqrt(a^2 + b^2)]If it is not free-form, we can nest the inline macros:
\my-macro[some text with \emoji(thinking)]2nd case also shares same syntax with anchor
Example
\u(1f600) -> (unicode 1f600)
\gh[neovim/neovim] -> {https://github.com/neovim/neovim}[neovim/neovim]
\nvimhelp[:h 'shiftwidth'] -> {https://neovim.io/doc/user/options.html#'shiftwidth'}[`:h 'shiftwidth'`]
\latex[\alpha + \beta = \gamma] -> (Abstract Object representing LaTeX math equiation)
Cons
- While
\uis ok,\tor\nmight confuse users. - How to handle
_\m_or-\m-? Macro name can conflict with underline/strikethrough closing modifiers.- This wouldn't be a problem with [Suggestion]: Generalize link-modifier to work everywhere #49